BuddyDev

Search

[Resolved] Check via PHP if user have galleries Mediapress

  • Participant
    Level: Enlightened
    Posts: 23
    Jkk on #33894

    Dear BuddyDev,

    How can we check via php code if user have gallery trought the id or username?
    Waiting your reply.

    Kind regards,
    jkk

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #33906

    Hi,
    You may use

    
    $count = 	mpp_get_gallery_count( array(
    		'component'    => 'members',
    		'component_id' => $user_id, // replace with user id.
    		'type'         => 'photo',// photo, video,audio,doc
    		'status'       => 'public',// if empty, will check for all accessible galleries for the visitor
    	) );
    
    

    Regards
    Brajesh

    • This reply was modified 4 years, 1 month ago by Brajesh Singh. Reason: updated code
  • Participant
    Level: Enlightened
    Posts: 23
    Jkk on #33911

    Hi Brajesh,

    Thank you very much! worked!

    1. It also possible check with the same way, the media of a particular gallery from his ID trought PHP?
    2. How can we check also with jq and ajax?

    Waiting your reply.

    Kind regards,
    Giacomo

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #33922

    Hi Giacomo,
    Please make sure to avoid the return statement. I have updated the code.

    1. Please clarify the question. I am not sure of the question.
    2. The php code can be used in your ajax handler, I do not see any issue. If you want to implement a client side check using js, you can create an ajax andpoint for your own implementation that checks the status.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 23
    Jkk on #33938

    Hi Brajesh,

    thank you for the reply.
    1. How can we check via PHP code how many media have a gallery id?
    2. Same to first question but an example with JS.
    Thank you in advance.

    Kind regards,
    Jkk

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #33953

    Hi
    1. Do you need to know the count of media in a gallery? do want to knwo it with privacy or without privacy?

    2. I will suggest looking at anyone of the tutorials in the search
    https://www.google.com/search?q=wordpress+ajax+example&oq=wordpress+ajax+example

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 23
    Jkk on #33966

    Hi,

    Thank you for your reply.
    1. Without privacy

    Thanks in advance.

    Regards,
    jkk

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #33968

    Sure,

    
    $count = mpp_gallery_get_media_count( $gallery_id );// please change gallery id.
    

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 23
    Jkk on #33999

    Hi Brajesh,

    Thank you very much, works!

    Regards,
    Jkk

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #34003

    You are welcome.

The topic ‘ [Resolved] Check via PHP if user have galleries Mediapress’ is closed to new replies.

This topic is: resolved