PDA

View Full Version : Problem with showing album link in postbit


Mark.B
03-24-2009, 08:38 PM
I am using THIS (https://vborg.vbsupport.ru/showthread.php?t=198477&highlight=postbit+album) mod to try and get a link to show in postbit/postbit legacy if a user has any albums. However, as written the mod does not work for me (3.8.1 PL1). The mod author is not about so I am trying to fix it myself.

The problem is that this conditional is always returning false:

if (!empty($post['hasalbum']))

So the code does not show up. I can remove the conditional and the code will show fine, but obviously for everyone, even if they have no album.

The sub query being used at hook location showthread_query is this:
$hook_query_fields .= ",album.userid as hasalbum";

$hook_query_joins .= "LEFT JOIN (SELECT state, userid, MAX(albumid) AS hasalbum FROM " . TABLE_PREFIX . "album GROUP BY userid) album ON(user.userid = album.userid AND album.state = 'public')";
I can't work out why this isn't working for me....looking at the thread it works for some and not others. What's wrong? What other conditional could I replace that conditional with to try and make it work?

Lynne
03-24-2009, 09:08 PM
Try looking at your error_logs and seeing if there is something in there about the query.

Mark.B
03-24-2009, 11:38 PM
Thanks Lynne, no, nothing at all in there.

Lynne
03-24-2009, 11:48 PM
Where are you doing the condition? Are you sure the query is done before that plugin?

Mark.B
03-25-2009, 12:31 AM
Where are you doing the condition? Are you sure the query is done before that plugin?
I think so....it's showthread_query for the query, followed by postbit_display_start for the conditional.

Lynne
03-25-2009, 02:52 AM
I believe in postbit_display_start you need to use $this->post, not $post.

Dismounted
03-25-2009, 06:55 AM
Either will work, they are one and the same (by-ref).

Mark.B
03-25-2009, 06:57 AM
Thanks...but still not working.

Got me baffled this...

Lynne
03-25-2009, 03:04 PM
I just tested this on my test site and it works just fine. Are you sure you have an up-to-date postbit (or postbit_legacy) template that has the correct template_hook for it to show?

Mark.B
03-25-2009, 05:37 PM
Thanks Lynne....Yes, definitely. I know this because I have removed the conditional so that the code shows up for everyone, and it's appearing ok.

There are others in the mod thread saying it isn't working for them....I wonder if it's one of those mods that only works under certain server configurations.

Lynne
03-25-2009, 07:16 PM
I looked at the code - there is nothing in there that would be server restrictive. It's an extremely simple straightforward mod. I read the thread and the users it wasn't working for were either not using 3.8.x or didn't have the template_hook. You could try turning off your other mods and seeing if it then works. Maybe you have another mod installed that is conflicting with this one.

Mark.B
03-25-2009, 10:09 PM
Thanks Lynne. Rather than go through each mod (as I have loads), I focused instead on plugins that use showthread_query as I figured that had to be where the problem was.

And it turns out that Photoplog (which I have installed but no longer use, it's only there for people who still had pictures in it from pre-vB3.7) was the culprit. Photoplog uses the same hook for a similar feature and there must have been a conflict.

I have disabled that and it works now.

inciarco
01-28-2011, 12:34 AM
Hello.

Is it Possible to Apply this Same Concept of Plugins to Display on the Memberlist the Album Link Only For Users that Have Albums? :confused:

What Code Changes Should I Make for it to be Done? :confused:

I Send You My Best Regards.

:)