Pages: 1
Hi.
Using the community extension and some others, how can I get a link or a block to show each member their own albums separate from the rest?
Piwigo 2.10.2
Operating system: Linux
PHP: 7.0.33
MySQL: 5.6.48-cll-lve
Graphics Library: GD bundled (2.1.0 compatible)
Last edited by Eddejessup (2020-07-15 08:52:44)
Offline
Wasn't sure if I was clear on the last post..
So it's a quick way for members to get to their own album section basically. Either with a block on the side menus, or even just a link would be good. Any way to get this ?
Thanks in advance.
Offline
Now, I don't know hardly (if any PHP) but the solution would be something like this..
IF user is logged in...
SELECT category_id FROM `piwi_community_permissions` where user ID = current logged in ID
$category=category_id
SELECT name , permalink from piwi_categories where id = $category ;
$album-name=name
$permalinkname=permalink
echo $album
echo <h2>My Album</h2>
echo <a href="index.php?/category/$permalinkname">$album-name</a>
Could anyone help .. am really trying to get this working, trying to fathom the code of the communities plugin.. just not wise enough to follow the php there.
Offline
Shame I'm not getting feedback on this, have developed some php in conjunction with another, but we're just getting errors.
Surely someone has an idea of how to get this on a side menu. I added as a personal plugin with localfiles, but didn't work.
This is what we had..
if (isset($_SESSION['community_user_id']))
{
$user_id = $_SESSION['community_user_id'];
} else {
fwrite(STDERR, "An error occurred.\n");
exit(1); // Add your custom response here or do some other thing like redirect etc...
}
$query = '
SELECT
`category_id`
FROM '.COMMUNITY_PERMISSIONS_TABLE.'
WHERE (user_id = '.$user_id.')';
$result = pwg_query($query);
$row = pwg_db_fetch_assoc($result);
$category = $row['category_id'];
$query_b = '
SELECT
`name`,
`permalink`
FROM '.CATEGORIES_TABLE.'
WHERE (id = '.$category.')';
$result_b = pwg_query($query_b);
$row_b = pwg_db_fetch_assoc($result_b);
$album_name = $row_b['name'];
$permalink_name = $row_b['permalink'];
// echo $album
echo '<h2>My Album</h2>';
echo '<a href="index.php?/category/' . $permalink_name . '">' . $album_name . '</a>';
Last edited by Eddejessup (2020-07-17 13:16:16)
Offline
This plugin almost solved the answer, in fact that will do.
https://piwigo.org/ext/extension_view.php?eid=722
Offline
Pages: 1