• Resolved AWOL

    (@awol)


    Hi,
    Great plugin, thank you. I just wondered if there is a way to only display the current user’s posts from across the network? I have front end dashboards on each subsite that currently have a ‘my posts’ section but at present they only show the posts from that particular subsite using a shortcode from another plugin, and I have added a link to their equivalent dashboards on the other subsites, but I would obviously like to display all their posts in one place if it is possible.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author johnzenausa

    (@johnzenausa)

    @awol
    Are you asking me to display posts only from a given author?

    If you are you may add this attribute to the shortcode:

    [netsposts author='48'] will only show posts from the author with author ID number 48. Then you may create a page for any author on any page in the blog. This will only display posts from the given author. 🙂

    • This reply was modified 2 years, 11 months ago by johnzenausa. Reason: Giving optional shortcode
    • This reply was modified 2 years, 11 months ago by johnzenausa. Reason: forgot back tick on shortcode
    Thread Starter AWOL

    (@awol)

    Hi,
    No, that’s not exactly what I am after but I think I might be able to make it work. Basically I want the currently logged in user to be able to view all their posts from across the network on their frontend profile page, so I want to add a shortcode in a template to do that. I think I can achieve it by creating a function/action to call the current user and place it into the shortcode, which then creates a new shortcode that I can put in the template using do_shortcode. I was hoping that there might already be a current user filter for the built in shortcode. Thank you anyway.

    Plugin Author johnzenausa

    (@johnzenausa)

    @awol Hi,
    You are correct I don’t have that filter.

    I will add the following attribute in the next update:
    author='current_user' and it will only work if the current user is logged in. If the visitor is not logged in it will ignore the author= attribute and display the lists normally. So if you have [netsposts author='current_user'] and the user has no posts of their own it will just display a blank list since he/she doesn’t have any posts her/himself.

    I have one ready if you’d like to try it out please go here:
    https://support.agaveplugins.com/contact and fill out the form and I will email it to you.

    • This reply was modified 2 years, 11 months ago by johnzenausa.
    Plugin Author johnzenausa

    (@johnzenausa)

    @awol

    Actually I’m going to implement the next update now. If you would like it to only show when the user is logged in the below plugin will do the job.

    https://wordpress.org/plugins/conditional-blocks/

    Remember add the attribute author=’current_user’. All other attributes work as expected of course. 🙂

    Thread Starter AWOL

    (@awol)

    Thanks for the quick responses! I will try it out when the update is available. I did try the author=’1′ but that does not seem to work, either directly as a shortcode in a page or in a template. It wasn’t listed in your documentation either so is this something in the update?

    Plugin Author johnzenausa

    (@johnzenausa)

    Yes it’s something from the update. Plus to show only for logged in users that other plugin is extremely useful. That plugin author did a good job.

    Thread Starter AWOL

    (@awol)

    I have now installed the update and it works perfectly – thank you very much.

    Plugin Author johnzenausa

    (@johnzenausa)

    Just one correction about displaying posts by a given author. You don’t use the id but the author’s slug. Of course current_user remains the same.

    Here’s an example:
    author='username_slug'

    For more than one make a comma separated list.
    author='username1_slug,username2_slug'.

    Of course to show current user it’s still
    author='current_user'.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Filter by current user?’ is closed to new replies.