BuddyDev

Search

[Resolved] Match Folder names to users and albums via SQL

  • Participant
    Level: Master
    Posts: 163
    Audiomonk on #31170

    Hi..

    I notice on the server that the mediapress folders are organised by user ID then the subfolders also have numbers..

    What SQL query can I run in phpmyadmin that will give me a list of matching ID’s to user name and folder number to album name ?

    Thanks in advance..

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #31191

    Hi,
    Thank you for the question.

    Here is a query that will list user name, directory_path

    
    SELECT user_login, CONCAT( "wp-content/uploads/mediapress/members/", ID) FROM wp_users
    

    Please change wp_users to your users table name.

    Here is a query that lists user, user_gallery and user_gallery path

    
    SELECT user_login, CONCAT( user_login, "/" , post_title) as user_gallery, CONCAT( "wp-content/uploads/mediapress/members/", wp_users.ID, "/", wp_posts.ID ) as user_gallery_path FROM wp_posts, wp_users WHERE post_author=wp_users.ID AND post_type="mpp-gallery" AND post_status="publish"
    
    

    Please make sure to change wp_posts & wp_users with the correct table name(you might have a different prefix than wp).

    Here is how it should look.

    https://i.imgur.com/oYCsk3s.png

    Hope that helps.

    Regards
    Brajesh

  • Participant
    Level: Master
    Posts: 163
    Audiomonk on #31201

    Thanks Brajesh, that was exactly what I was after, much appreciated.

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #31210

    You are welcome. I am glad it helped.

    Regards
    Brajesh

The topic ‘ [Resolved] Match Folder names to users and albums via SQL’ is closed to new replies.

This topic is: resolved