• Resolved rootstone

    (@rootstone)


    Hi Aldo or other contributors,

    I have to say,

    “This is a great and powerful Widget!!”

    I have a special need to display certain posts for certain user. I already set a meta for those posts with a certain username. So my goal is to display these posts when this user logs in, not other posts.

    I read all the docs you provided but I don’t know much about coding and really need your help to understand or get the codes for it.

    I read the link of “wp-query” you provided and know there is a query to get user ID:

    Line 2430: $user_id = get_current_user_id();

    So my request is:

    Could you help me with a shortcode (please tell me where to put it) that will query the user id for logged in user (this widget is for logged-in users) and display the posts with the meta info which I set with the logged-in user ID.

    Many many many thanks for helping me!
    Stone

    • This topic was modified 5 years ago by rootstone.
Viewing 14 replies - 16 through 29 (of 29 total)
  • Okay, now i get it. So the first step is to mark the posts. I had erroneously thought that the plugin shows the person viewing the website posts he or she has published after that check box is ticked.

    Thread Starter rootstone

    (@rootstone)

    Hi Aldo,

    I found today that I couldn’t turn on the option “Get posts from username” anymore. I ticked on and save, then when I went back to check, it’s still OFF.

    I deactivated and deleted it and re-installed it, no change.

    Do you know what’s wrong? I noticed you had a few updates in the past month. Not sure it’s related or not.

    Thanks for your help~~

    Thread Starter rootstone

    (@rootstone)

    Update:

    I tried other options – to check them and click save, they all turned out still unchecked. This means I can’t make changes at all.

    Help needed.

    Plugin Author Aldo Latino

    (@aldolat)

    Hi Stone,
    I tried activating that option in all my sites (staging and production) and the activation/deactivation process works as expected.

    If you can’t activate/deactivate any option of Posts in Sidebar, I think that something is wrong in the database record of the plugin.

    Have you tried uninstalling and reinstalling the plugin? Be aware that this means that you will lose all Posts in Sidebar widgets.

    Let me know, please.

    Thread Starter rootstone

    (@rootstone)

    Hi Aldo,

    Yes, I did uninstall and installed it yesterday. but the problem still exists. That’s why I ask here for your help~

    I just uninstalled and re-installed it again and here is the screenshot after I clicked “Save”:https://prntscr.com/qqt74b

    screen recording:https://www.youtube.com/watch?v=ua6JlW7iM_s

    Thanks,
    Stone

    • This reply was modified 4 years, 10 months ago by rootstone.
    • This reply was modified 4 years, 10 months ago by rootstone.
    Plugin Author Aldo Latino

    (@aldolat)

    Stone,
    I think that a plugin or a theme is in conflict with Posts in Sidebar.

    The only way to verify if this conflict is true is to deactivate all the plugins, excluding Posts in Sidebar, and activate one of the standard themes of WordPress. Then, see if the problem persists.

    It’s not simple to figure out why you are having trouble with the activation of the options. It’s something that I’ve never seen before.

    Let me know, please.

    Thread Starter rootstone

    (@rootstone)

    Hi Aldo,

    I finally found that it’s the plugin – Private Content Plus which has a conflict with Posts in Sidebar. I uninstalled it but it’s hard to find an alternative…

    And I found that if I deactivate Private Content PLus first and make changes to Posts in Sidebar, your plugin will work fine. So I guess I need to deactivate it before I make any changes…

    Thanks again for your suggestions and this plugin!

    Stone

    Plugin Author Aldo Latino

    (@aldolat)

    Hi Stone,
    glad you found the origin of the problem.

    Is this the plugin? I would to test it.

    Thread Starter rootstone

    (@rootstone)

    Yes, right.

    Thanks a lot for your efforts~~

    Plugin Author Aldo Latino

    (@aldolat)

    I confirm. I just installed it and I noticed that this plugin resets all the checkboxes.

    I tried some widgets and the problem is visible in Posts in Sidebar and in Archives widgets (one of the WordPress standard widgets). I tried other widgets but the problem is not visible.

    I think that the module of WP Private Content Plus that manages the visibility is the origin of the problem (the part with the red frame here below):

    I’m curious to find why.

    Hello,
    This is a great plugin. A saviour for me. However, I can’t seem to make it work right for me
    I am using the Advanced Custom Fields to create Meta Tags. But it still displays for everyone.
    I tried using the shortcode, couldnt get it right.
    Can someone guide me as to what should I do first ?

    Plugin Author Aldo Latino

    (@aldolat)

    Hello @penterdigital,
    I’m glad you find this plugin useful!

    Regarding the problem, could you be more specific? Could you tell me what do you want to do and how you’re trying to obtain it?

    He @aldolat
    Appreciate your prompt response. So this is what I am trying to do
    Creating a post & placing it under category John Doe.
    Marking the Get Posts by Category under the widget
    Logging in as John Doe.

    But when I do login is as John Doe, I am still able to see posts by Jane Doe

    Plugin Author Aldo Latino

    (@aldolat)

    @penterdigital
    In order to display certain posts to a certain user (let’s say, John Doe), you have to mark those posts with the username of that user.

    You can follow two ways: using custom fields or using categories.

    Let’s say that you want to use the categories. In this case, create a new category with the same name as the user [1]. Manually assign certain posts to this new category (i.e., the posts you want to show to John Doe). When this step is completed, go to the widget panel in the dashboard, create a new Posts in Sidebar widget (in order to make sure that no other option is in conflict with what we’re doing), and activate both the options “Get posts from current username” and “Use category instead of meta key” located in the panel “Getting posts” > “Get posts from username”. Save the widget.

    Now, if you go to the site using the account of John Doe, you will see the posts marked with the category “John Doe”.

    If, alternatively, you want to use custom fields, the work is the same, except the fact that you will use custom fields. In this case, however, instead of using a category, you will mark the posts with a custom field where the key (not the value, since the value is ignored) has the same name as the user. Then, you will activate the option “Get posts from current username”, leaving inactive the option “Use category instead of meta key”.

    I hope this will make the things more clear. ??

    Let me know, please.

    Notes.
    [1] Make sure that the slug of the category “John Doe” (or the key of the custom field) is identical to the username of John Doe. So, if the username is johndoe, the slug should be johndoe and not john-doe or john_doe.

Viewing 14 replies - 16 through 29 (of 29 total)
  • The topic ‘How to display posts to certain user’ is closed to new replies.