WordPress.org

Ready to get started?Download WordPress

Forums

Optional Content
Please help - specific user only not working? (4 posts)

  1. Tony
    Member
    Posted 3 years ago #

    I installed the Optional Content plugin and I want to display specific content for a specific user.

    When using the plugin, I clicked the [i] button in my toolbar, then clicked ‘Only to specific user’ and then chose the username (example: bob45 – user id is (6)). Then I click OK and the following appears in my visual editor:

    [optional_content type='' ]
    Content here
    [/optional_content]

    I asked someone about it and they said it seems like it's broken because it used to work and now it's not working for them either.

    Could someone please help me?

  2. jRayx
    Member
    Posted 3 years ago #

    Hey Tony, in "plugins\optional-content\tinymce_plugin.js" starting on line 46 remove this section of code :

    else if(type == 'user-id'){
    		jQuery(".oc_field").hide();
    		jQuery("#users_grp").show();
    	}

    and then on line 169 that looks like this :

    <option><?php echo $user->user_login . " (" . $user->ID . ")"; ?></option>

    change it to this :

    <option value="<?php echo $user->ID ?>"><?php echo $user->user_login . " (" . $user->ID . ")"; ?></option>

    That should fix that little piece of functionality for you :)

  3. paulg000
    Member
    Posted 3 years ago #

    Seems that w/WP 3.1.2 this plugin is leaving out some code when you try and hide content based on username. The full first line needs to be:

    [optional_content type='user-id' value='1' ]

    where '1' is the number next to the username.

    Hope that helps -- the above fix didn't work for me as the code was completely different.

  4. Tony
    Member
    Posted 3 years ago #

    Wow that worked thanks... Nice going Paul!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic