• I have php code that switches back and forth with html using the php if statement where it would show a shortcode of another plugin and this new version just can’t handle it. The old version handled it without any issues at all, smooth as silk. But with this newer version I wasted a good amount of time trying to make it work with my php code and failed to get it to do what it is supposed to do.

    Maybe it works for simpler php code but for more complicated code it just breaks. If it takes more than an hour to try to make this work then maybe this plugin itself is what needs to be worked on.
    Safe yourself a lot of time and use the old version.

    • This topic was modified 6 years, 8 months ago by WDjoe. Reason: more detail on why it fails, better wording
    • This topic was modified 6 years, 8 months ago by WDjoe.
    • This topic was modified 6 years, 8 months ago by WDjoe.
    • This topic was modified 6 years, 8 months ago by WDjoe.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author webcraftic

    (@webcraftic)

    Hi,

    This is all not true, the plugin is able to execute any php code, including complex. If you do not have enough programming skills, this does not mean that the problem is in the plugin.

    Can you give an example of a script that can not be implemented with this plugin?

    Best regards, Alex

    Thread Starter WDjoe

    (@wdjoe)

    Hi,

    If it worked as good or better than the last version than a simple cut and paste of the same code is all that would be needed for it to work…and it does not do that. It’s that simple, hence my one star rating.

    Here is the code that fails to show a map using the [us_map] shortcode from the US Map plugin.

    <?php
    
    if ( is_user_logged_in() ) {
    	
    $user_id = get_current_user_id();
    if ($user_id == 0) {
        echo '';
    } else {
      
    }
    
    echo '<br/>';
    
    global $wpdb;
    
    $category = 'teacher';
    
    $q = $GLOBALS['wpdb']->get_results( 'SELECT 
    
    *, wp_frm_item_metas.meta_value AS category
    
    FROM '. $wpdb->prefix .'frm_item_metas, wp_frm_items
    
    WHERE 
    
    wp_frm_item_metas.meta_value = "teacher"
    
    AND wp_frm_items.user_id ='.$user_id.' 
    
    AND wp_frm_item_metas.item_id = wp_frm_items.id
    
     LIMIT 1', OBJECT);
    
    foreach($q as $row)
    
    if ($row->category != 'teacher'){ 
    	echo'STUDENT';
    }
    
     {	
      
        if ($row->category != 'teacher'){		
    		
    		?>
            [us_map]
            
            <?php
    			
    	} else {
    		
    	?>	
        [us_map]
        
        <?php
    	}
    	
     }
    
    } 
    
    ?> 
    • This reply was modified 6 years, 8 months ago by WDjoe.
    Plugin Author webcraftic

    (@webcraftic)

    Snippets offer many advantages. For example:
    1. You can run the code globally, not just in the posts
    2. The same code is not duplicated
    3. It’s easy to change the code if you have 10,000 posts and each uses a shortcode
    4. It is safer, because no one but the administrator can edit this code
    5. You can transfer your snippets to another site
    6. The code has special formatting and syntax highlighting
    7. You can disable your snippet, right away in all posts

    I corrected your code, but there are a lot of contradictions in it. I correctly understand that the code should only work for authorized users?

    The map should be shown only to those who are not teachers?

    To call the shortcode of another plugin in the snippet, you must use this function:
    echo do_shortcode('[us_map]');

    My version of the short code:

    if( is_user_logged_in() ) {
    		global $wpdb;
    
    		$user_id = get_current_user_id();
    
    		if( $user_id == 0 ) {
    			echo '';
    		} else {
    
    			echo '<br/>';
    
    			$category = 'teacher';
    
    			$q = $GLOBALS['wpdb']->get_results('SELECT
    			*, wp_frm_item_metas.meta_value AS category
    			FROM ' . $wpdb->prefix . 'frm_item_metas, wp_frm_items
    			WHERE
    			wp_frm_item_metas.meta_value = "teacher"
    			AND wp_frm_items.user_id =' . $user_id . '
    			AND wp_frm_item_metas.item_id = wp_frm_items.id
    			 LIMIT 1', OBJECT);
    
    			foreach($q as $row) {
    				if( $row->category != 'teacher' ) {
    					echo 'STUDENT';
    					echo do_shortcode('[us_map]');
    				}
    			}
    		}
    	}

    This is your code, I just changed the method of calling the shortcode map:

    if ( is_user_logged_in() ) {
    
    	$user_id = get_current_user_id();
    	if ($user_id == 0) {
    		echo '';
    	} else {
    
    	}
    
    	echo '<br/>';
    
    	global $wpdb;
    
    	$category = 'teacher';
    
    	$q = $GLOBALS['wpdb']->get_results( 'SELECT
    
    *, wp_frm_item_metas.meta_value AS category
    
    FROM '. $wpdb->prefix .'frm_item_metas, wp_frm_items
    
    WHERE
    
    wp_frm_item_metas.meta_value = "teacher"
    
    AND wp_frm_items.user_id ='.$user_id.'
    
    AND wp_frm_item_metas.item_id = wp_frm_items.id
    
     LIMIT 1', OBJECT);
    
    	foreach($q as $row)
    
    		if ($row->category != 'teacher'){
    			echo'STUDENT';
    		}
    
    	{
    
    		if ($row->category != 'teacher'){
    			
    			echo do_shortcode('[us_map]');
    
    		} else {
    			
    			echo do_shortcode('[us_map]');
    		}
    
    	}
    
    }
    • This reply was modified 6 years, 8 months ago by webcraftic.
    Thread Starter WDjoe

    (@wdjoe)

    Thank you for your assistance. The tweaking of my code did work.

    I stand corrected by you, now it’s time for me to go eat some humble pie.

    Good work with this latest update of the plugin. I guess I just needed more understanding of it and in which it was nice of you to take the time to explain it to me.

    • This reply was modified 6 years, 8 months ago by WDjoe.
    Plugin Author webcraftic

    (@webcraftic)

    Hi,

    I’m really to blame for not having written the documentation on how to migration the code from the old version to the new one.

    Thank you for changing your review! I will try to make the plugin more convenient and useful for you.

    If you need help, let me know!

    Best regards, Alex

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Very clunky, old version so much better. (UPDATED REVIEW)’ is closed to new replies.