Support » Plugin: Floating Div » Allow PHP

Viewing 6 replies - 16 through 21 (of 21 total)
  • Plugin Author PluginlySpeaking

    (@pluginlyspeaking)

    Did you try something like this :

    [psfd_php]
    if ( 0 != get_current_user_id() ) {
    $suffix_url = get_the_author_meta( ‘user_description’, get_current_user_id() );
    } else {
    $suffix_url = ‘Not logged in user’;
    }

    echo ‘<iframe width=”362″ height=”395″ src=”http://something.com/&#8217;.$suffix_url.'” frameborder=”0″></iframe>’;

    [/psfd_php]

    I use get_the_author_meta instead of just the_author_meta because you need to store the value in a variable, and not just display it.

    In this example, I think you should modify the “else” of the conditions, because it will give you an unreachable URL.

    Best Regards,
    PluginlySpeaking

    Thanks for the help but this code complete removes the floating div.

    Well i dont know you made PHP codes work that was my request but i just cant make it work with what i need.

    If u can (you dont need to) do you have other ideas of solveing it?
    I will try to ask in wordpress forums.

    Plugin Author PluginlySpeaking

    (@pluginlyspeaking)

    On my side, I have the floating div with an empty iframe. The floating div isn’t removed.

    If you used copy/paste, did you check that the quotes aren’t modified ?

    [psfd_php]
    if ( 0 != get_current_user_id() ) {
    $suffix_url = get_the_author_meta( 'user_description', get_current_user_id() );
    } else {
    $suffix_url = 'Not logged in user';
    }
    
    echo '<iframe width="362" height="395" src="http://something.com/'.$suffix_url.'" frameborder="0"></iframe>';
    
    [/psfd_php]

    Here is a version with code balise, maybe I should have use them earlier.

    Best Regards,
    PluginlySpeaking

    Now its working! Thank you so much <3

    Plugin Author PluginlySpeaking

    (@pluginlyspeaking)

    You are welcome.
    Just some advices about this piece of code we added.

    Be careful with $suffix_url, the variable isn’t initialized and if the user isn’t logged, I doubt the URL ending with space will be found.

    Also be careful in general, there is absolutely no test in the shortcode psfd_php, it reads the PHP you put inside and that’s all.

    Best Regards,
    PluginlySpeaking

    Yes no problem.
    And yes i will check security etc.

    Thanks again!

Viewing 6 replies - 16 through 21 (of 21 total)
  • The topic ‘Allow PHP’ is closed to new replies.