Hi,
How are we supposed to use the conditional tags? Let's say I want to use is_rtmedia_edit_allowed() to allow users to edit their album.
What am I supposed to do with it?
Thanks for your help, Laurent.
Hi,
How are we supposed to use the conditional tags? Let's say I want to use is_rtmedia_edit_allowed() to allow users to edit their album.
What am I supposed to do with it?
Thanks for your help, Laurent.
if ( is_rtmedia_edit_allowed() ) { // this will be executed if edit is allowed } else { // this will be executed if edit is not allowed }
That is the general approach. Conditional tags help you do something if a certain condition is met and to do something different if the condition is not met.
Hi Henry,
Thanks for your reply. Is it something I have to add to functions.php ?
Thanks, L.
Hi Laurent
conditional logic goes anywhere you need it really, there is no set place. It can go in functions.php as part of a function or you could use it in your theme.
Henry
Hi Henry,
I'm not really sure to understand how to use it. I simply want to add a code that states that the author of a post can edit/delete the gallery of that specific post, and this for any author/post/page on the website.
Thanks, Laurent.
I'm pretty sure a post's photo gallery isn't the same as an rtMedia photo gallery. An rtMedia photo gallery is specific to a member, not specific to a post.
Hi Henry,
The way I understood it is that rtmedia uses context to link media with post or page as written here: http://rtcamp.com/rtmedia/docs/core-concepts/context/
When using it, I can indeed only see the pictures gallery on the post they were uploaded, so I guess I should be able to edit/delete them from the same spot.
@laurent thanks for pointing out the "media context" - The uploader is much more powerful than I thought. Glad you worked it out!
Hi @Henrywright,
Glad it helps you. Knowing about the use of context, I'm still looking for a way to connect it with the above-mentioned conditional tags.
Any suggestions would help. L.
@laurent - Let me try to understand your requirement here. You want to use a shortcode or template tag in a post and want to make sure the author of the post has the permission to edit or delete the media in that gallery through the shortcode/template tag?
Hi @joshuaabenazer,
That's exactly what I need. It all should happen from the front-end.
thanks, Laurent.
@laurent - Actually this would depend on your theme. You would need to have a look at the template hierarchy of WordPress -> http://codex.wordpress.org/Template_Hierarchy and identify which file in your theme would be responsible for the page/post in which you would like to implement this.
Once you have identified that, you could add the following code to that file, preferably inside the WordPress Loop ( http://codex.wordpress.org/The_Loop )
if ( is_single() ) { // This should be changed to which post type page you actually are on. Check http://codex.wordpress.org/Conditional_Tags
$currentuser = get_currentuserinfo();
if ( get_the_author() == $currentuser->display_name ) {
rtmedia_uploader(); // for the uploader
rtmedia_gallery(); // for the gallery
}
}
Hi @JoshuaAbenazer,
Did something change in the latest update of the plugin? Now I automatically see an edit and delete button on each picture when using the author's login.
@laurent - I guess that was available before also. You can have a look at the changelog for a better picture -> http://wordpress.org/plugins/buddypress-media/changelog/