• Notice: Undefined variable: ReturnString in /wp-content/plugins/front-end-only-users/Shortcodes/Insert_Reset_Password.php on line 11

    Can be solved by moving line 20 to anywhere above line 10.

    function Insert_Edit_Account_Form($atts) {
    	global $wpdb, $user_message, $feup_success;
    	global $ewd_feup_user_table_name;
    
    	$Custom_CSS = get_option("EWD_FEUP_Custom_CSS");
    
    	// Get the attributes passed by the shortcode, and store them in new variables for processing
    	extract( shortcode_atts( array(
    				'redirect_page' => '#',
    				'login_page' => '',
    				'submit_text' => __('Update Account', 'EWD_FEUP')),
    			$atts
    		)
    	);
    
    	$ReturnString = "";
    
    	$CheckCookie = CheckLoginCookie();
    
    	if ($CheckCookie['Username'] == "") {
    		$ReturnString .= __('You must be logged in to access this page.', 'EWD_FEUP');
    		if ($login_page != "") {$ReturnString .= "<br />" . __('Please', 'EWD_FEUP') . " <a href='" . $login_page . "'>" . __('login', 'EWD_FEUP') . "</a> " . __('to continue.', 'EWD_FEUP');}
    		return $ReturnString;
    	}
    
    	/*$Sql = "SELECT * FROM $ewd_feup_fields_table_name ";
    	$Fields = $wpdb->get_results($Sql);*/
    	$User = $wpdb->get_row($wpdb->prepare("SELECT * FROM $ewd_feup_user_table_name WHERE Username='%s'", $CheckCookie['Username']));
    
    	$ReturnString .= "<style type='text/css'>";
    	$ReturnString .= $Custom_CSS;
    	$ReturnString .= "</style>";
    
    	if ($feup_success and $redirect_page != '#') {FEUPRedirect($redirect_page);}
    
    	$ReturnString .= "<div id='ewd-feup-edit-profile-form-div'>";
    	if (isset($user_message['Message'])) {$ReturnString .= $user_message['Message'];}
    	$ReturnString .= "<form action='#' method='post' id='ewd-feup-edit-profile-form' class='pure-form pure-form-aligned'>";
    	$ReturnString .= "<input type='hidden' name='ewd-feup-check' value='" . sha1(md5($Time.$Salt)) . "'>";
    	$ReturnString .= "<input type='hidden' name='ewd-feup-time' value='" . $Time . "'>";
    	$ReturnString .= "<input type='hidden' name='ewd-feup-action' value='edit-account'>";
    	$ReturnString .= "<input type='hidden' name='Username' value='" . $User->Username . "'>";
    	$ReturnString .= "<div id='ewd-feup-register-username-div' class='ewd-feup-field-label'>" . __('Username', 'EWD_FEUP') . ": " . $User->Username . "</div>";
    	$ReturnString .= "<div class='pure-control-group'>";
    	$ReturnString .= "<label for='User_Password' id='ewd-feup-edit-password' class='ewd-feup-field-label'>" . __('Password', 'EWD_FEUP') . ": </label>";
    	$ReturnString .= "<input type='password' class='ewd-feup-text-input' name='User_Password' class='ewd-feup-text-input pure-input-1-3' value='' />";
    	$ReturnString .= "</div>";
    	$ReturnString .= "<div class='pure-control-group'>";
    	$ReturnString .= "<label for='Confirm_User_Password' id='ewd-feup-edit-confirm-password' class='ewd-feup-field-label'>" . __('Repeat Password', 'EWD_FEUP') . ": </label>";
    	$ReturnString .= "<input type='password' class='ewd-feup-text-input' name='Confirm_User_Password' class='ewd-feup-text-input pure-input-1-3' value='' />";
    	$ReturnString .= "</div>";
    	$ReturnString .= "<div class='pure-control-group'><label for='submit'></label><input type='submit' class='ewd-feup-submit pure-button pure-button-primary' name='Edit_Password_Submit' value='" . $submit_text . "'></div>";
    	$ReturnString .= "</div>";
    
    	return $ReturnString;
    }
    add_shortcode("account-details", "Insert_Edit_Account_Form");

    https://www.ads-software.com/plugins/front-end-only-users/

Viewing 1 replies (of 1 total)
  • Thread Starter tannermccoleman

    (@tannermccoleman)

    Same Undefined Variable issue also exists in Shortcodes/Privilege_Level.php.

    /* The function that creates the HTML on the front-end, based on the parameters
    * supplied in the product-catalog shortcode */
    function Privilege_Level($atts, $content = null) {
    		// Include the required global variables, and create a few new ones
    		global $wpdb;
    		global $ewd_feup_user_table_name, $ewd_feup_levels_table_name, $ewd_feup_user_fields_table_name;
    
    		$Custom_CSS = get_option("EWD_FEUP_Custom_CSS");
    
    		// Get the attributes passed by the shortcode, and store them in new variables for processing
    		extract( shortcode_atts( array(
    						 								 		'login_page' => '',
    																'no_message' => '',
    																'minimum_level' => '',
    																'maximum_level' => '',
    																'level' => '',
    																'field_name' => '',
    																'field_value' => '',
    																'sneak_peak_characters' => 0,
    																'sneak_peak_words' => 0),
    																$atts
    														)
    												);
    
    		$ReturnString = "";
    
    		$UserCookie = CheckLoginCookie();
    		if (!$UserCookie) {
    			  if ($sneak_peak_characters > 0) {$ReturnString = substr(do_shortcode($content), 0, $sneak_peak_characters) . "...<br>";}
    				if ($sneak_peak_words > 0) {$ReturnString = Return_Until_Nth_Occurance(do_shortcode($content), " ", $sneak_peak_words) . "...<br>";}
    
    				$ReturnString .= __("Please log in to access this content.", 'EWD_FEUP');
    				if ($login_page != "") {$ReturnString .= "<br />" . __('Please', 'EWD_FEUP') . " <a href='" . $login_page . "'>" . __('login', 'EWD_FEUP') . "</a> " . __('to continue.', 'EWD_FEUP');}
    				if ($no_message != "Yes") {return $ReturnString;}
    				else {return;}
    		}
    
    		$User = $wpdb->get_row($wpdb->prepare("SELECT * FROM $ewd_feup_user_table_name WHERE Username='%s'", $UserCookie['Username']));
    		$PrivilegeLevel = $wpdb->get_row($wpdb->prepare("SELECT Level_Privilege FROM $ewd_feup_levels_table_name WHERE Level_ID='%d'", $User->Level_ID));
    		$User_Data = $wpdb->get_results($wpdb->prepare("SELECT * FROM $ewd_feup_user_fields_table_name WHERE User_ID='%d'", $User->User_ID));
    
    		$ReturnString = do_shortcode($content);
    
    		if ($minimum_level != '' and $PrivilegeLevel->Level_Privilege < $minimum_level) {$ReturnString = "<div class='ewd-feup-error'>" . __("Sorry, your account isn't a high enough level to access this content.", 'EWD_FEUP') . "</div>";}
    		if ($maximum_level != '' and $PrivilegeLevel->Level_Privilege > $maximum_level) {$ReturnString = "<div class='ewd-feup-error'>" . __("Sorry, your account level is too high to access this content.", 'EWD_FEUP') . "</div>";}
    		if ($level != '' and $PrivilegeLevel->Level_Privilege != $level) {$ReturnString = "<div class='ewd-feup-error'>" . __("Sorry, your account isn't the correct level to acces this content.", 'EWD_FEUP') . "</div>";}
    		if ($field_name != '') {
    			  foreach ($User_Data as $Field) {
    						if ($Field->Field_Name == $field_name and $Field->Field_Value == $field_value) {$Validate = "Yes";}
    				}
    				if ($Validate != "Yes") {$ReturnString = "<div class='ewd-feup-error'>" . __("Sorry, this content is only for those whose " . $field_name . " is " . $field_value . ".", 'EWD_FEUP') . "</div>";}
    		}
    
    		if (substr($ReturnString, 0, 28) != "<div class='ewd-feup-error'>" or $no_message != "Yes") {return $ReturnString;}
    }
    add_shortcode("restricted", "Privilege_Level");
    
    function Return_Until_Nth_Occurance($String, $Needle, $N) {
    		$Count = 0;
    		while ($Count < $N) {
    				$Pos = strpos($String, $Needle);
    				if (strpos($String, $Needle) === false) {$Pos = strlen($String); $Count = $N;}
    				$ReturnString .= substr($String, 0, $Pos) . $Needle;
    				$String = substr($String, $Pos+1);
    				$Count++;
    		}
    
    		return $ReturnString;
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Reset Password creates Notice: Undefined variable: ReturnString’ is closed to new replies.