Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Same here. I can’t get in any snippet (PHP or HTML). Just installed on a fresh install of WordPress 6.4.1 and Code Snippets 3.6.2 with Elementor and woocommerce.

    Here is a really simple and quick implementation to create a shortcode for your website. maybe the devs for the plugin will just add this to their plugin class and create a shortcode.

    FYI: I added a little to the implementation suggestions, checking to see if the user is logged in or not. If yes, then logout url, If no, then the login and register butons.

    Add the following to your theme’s functions.php file.

    function simpleModalShortcode() {
    	if(( is_user_logged_in() )):
    		return '<p style="text-align: left;"><a href="'. wp_logout_url() .'">Logout</a></p> ';
    	else:
    		return '<p style="text-align: left;"><a class="simplemodal-login" href="/wp-login.php">Log In</a> | <a class="simplemodal-register" href="/wp-login.php?action=register">Register</a></p> ';
    	endif;
    }
    add_shortcode('simplemodal', 'simpleModalShortcode');

    Then add the shortcode [simplemodal] where it makes sense for you on the site.

    ??

    Wow! Same thing here. Had trouble and then created a post and all was good. Thanks @remedeez!

    For a quick fix, replace the sreg_basic function on line 438, with the following function.

    function sreg_basic($atts) {
    	//Check if the user is logged in, if so he doesn't need the registration page
    	if ( is_user_logged_in() AND !current_user_can('administrator') ) {
    		global $user_ID;
    		$first_visit = get_user_meta($user_ID, 'first_visit',true);
    		if(empty($first_visit)) {
    			$message = !empty($atts['message'])?$atts['message']:"Thank you for registering.";
    			update_user_meta($user_ID,'first_visit',date('Y-m-d'));
    			echo '<div id="message" class="success"><p>'.$message.'</p></div>';
    		} else {
    			echo "You are already registered for this site!!!";
    		}
    	} else {
    		//Then check to see whether a form has been submitted, if so, I deal with it.
    		global $sreg;
    		if(isset($sreg->success)) {
    			return $sreg->output;
    		} else {
    			if(is_array($sreg->errors)) {
    	        $out = '';
    	        foreach($sreg->errors as $mes) {
    	            $out .= '<div class="simplr-message error">'.$mes .'</div>';
    	        }
    	    } elseif(is_string($sreg->errors)) {
    	        $out = '<div class="simplr-message error">'.$message .'</div>';
    	    }
    	    return $out.simplr_build_form($_POST,$atts);
    		}
    
    	} //Close LOGIN Conditional
    
    } //END FUNCTION

    Thanks Pierre. This is exactly what I needed

    I got it working using the shared secret ad the token, but then it broke some of my other plugins.

Viewing 6 replies - 1 through 6 (of 6 total)