Skip to content

Issues-648: disable links for MFE #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions Topcoder/class.topcoder.plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,23 @@ function gdn_dispatcher_beforeControllerMethod_handler($sender, $args){
* Add scripts. Add script to hide iPhone browser bar on pageload.
*/
public function base_render_before($sender) {
if(isset($_SERVER['HTTP_REFERER'])) {
$url = $_SERVER['HTTP_REFERER'];
parse_str( parse_url( $url, PHP_URL_QUERY), $array );
$embedType = $array['mbed_type'];
if($embedType == 'mfe') {
$sender->addDefinition('MFEEmbedded', '1');
$sender->MasterView = 'mfe';
// logMessage(__FILE__,__LINE__,'TopcoderPlugin','base_render_before',"Use Embed Master Template due to HTTP_REFERER".$url);
}
}

// Force view options
if(getIncomingValue('embed_type') == 'mfe') {
$sender->addDefinition('MFEEmbedded', '1');
$sender->MasterView = 'mfe';
// logMessage(__FILE__,__LINE__,'TopcoderPlugin','base_render_before',"Use Embed Master Template due to Query Param");
}
if (is_object($sender->Head)) {
$sender->Head->addString($this->getJS());
}
Expand Down Expand Up @@ -2450,7 +2467,7 @@ function userPhoto($user, $options = []) {
$isTopcoderAdmin = val('IsAdmin', $topcoderProfile);
$photoUrl = isset($photoUrl) && !empty(trim($photoUrl)) ? $photoUrl: UserModel::getDefaultAvatarUrl();
$isUnlickableUser = TopcoderPlugin::isUnclickableUser($name);
$href = (val('NoLink', $options)) || $isUnlickableUser ? '' : ' href="'.url($userLink).'"';
$href = (val('NoLink', $options)) || $isUnlickableUser || getIncomingValue('embed_type') == 'mfe' ? '' : ' href="'.url($userLink).'"';

Gdn::controller()->EventArguments['User'] = $user;
Gdn::controller()->EventArguments['Title'] =& $title;
Expand Down Expand Up @@ -2540,7 +2557,7 @@ function userAnchor($user, $cssClass = null, $options = null) {
}

// Go to Topcoder user profile link instead of Vanilla profile link
$isUnlickableUser = TopcoderPlugin::isUnclickableUser($name);
$isUnlickableUser = getIncomingValue('embed_type') == 'mfe' || TopcoderPlugin::isUnclickableUser($name);
$userUrl = $isUnlickableUser? '#' : topcoderUserUrl($user, $px);

$topcoderProfile = TopcoderPlugin::getTopcoderUser($userID);
Expand Down