Announcement

#1 2020-07-14 23:05:42

Eddejessup
Member
2020-07-01
42

How to get a link so members can click straight to their album.

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

 

#2 2020-07-15 08:51:50

Eddejessup
Member
2020-07-01
42

Re: How to get a link so members can click straight to their album.

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

 

#3 2020-07-15 20:33:31

Eddejessup
Member
2020-07-01
42

Re: How to get a link so members can click straight to their album.

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

 

#4 2020-07-17 13:15:30

Eddejessup
Member
2020-07-01
42

Re: How to get a link so members can click straight to their album.

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

 

#5 2020-07-24 21:37:57

Eddejessup
Member
2020-07-01
42

Re: How to get a link so members can click straight to their album.

This plugin almost solved the answer, in fact that will do.


https://piwigo.org/ext/extension_view.php?eid=722

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2022 · Contact