solved My skin's Pending Followers menu link count stopped working

Strumelia
Strumelia
@strumelia
4 years ago
3,602 posts
I've had this code in my custom skin working fine for a long time, but it no longer works, not sure why.
In my custom skin's Menu template, I have this code:
{foreach from=$_items name="loop" item="entry"}
    {if isset($entry.menu_function_result) && strlen($entry.menu_function_result) > 0}
        {if is_numeric($entry.menu_function_result)}
        <li><a href="{$entry.menu_url}">{$entry.menu_label} [{$entry.menu_function_result}]</a></li>
            {else}
        <li><a href="{$entry.menu_url}">{$entry.menu_label} <img src="{$entry.menu_function_result}" alt="{$entry.menu_label}"></a></li>
        {/if}
        {else}

{if $entry.menu_label == "Private Messages"}
       {* CUSTOM CODE for pending followers in menu HERE *}
    {if jrUser_is_logged_in()}
    <li><a href="{$jamroom_url}/{$_user.profile_url}/follow">Pending Followers: {jrCore_list module="jrFollower" search1="follow_profile_id = `$_user._profile_id`" search2="follow_active = 0" return_count=true no_cache=true}</a></li>
    {/if}
{/if}

    <li><a href="{$entry.menu_url}">{$entry.menu_label}</a></li>
    {/if}
{/foreach}
...which resulted in a custom item in my profile dropdown menu which gave a number count of how many Followers were Pending approval for a member (and showed a numeral zero if there were none pending).
Now I see on both my own master admin profile and on a 'regular member' test profile, there are pending followers but no number shows in the drop down menu anymore like it should.
I assume some update tripped this up, what should I do? (BTW the same problem on my other pennywhistle site.)


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015

updated by @strumelia: 01/01/21 04:56:58PM
paul
@paul
4 years ago
4,325 posts
This is a result of a change we did to the Follower module several months ago. Followers used to be stored as DataStore items but that was a lot of overhead so they are now stored on a regular database table. Your custom code was still expecting them to be DataStore items. I've updated your template code to now use a default Follower module function to get the pending count directly -

{foreach from=$_items name="loop" item="entry"}
    {if isset($entry.menu_function_result) && strlen($entry.menu_function_result) > 0}
        {if is_numeric($entry.menu_function_result)}
        	<li><a href="{$entry.menu_url}">{$entry.menu_label} [{$entry.menu_function_result}]</a></li>
        {else}
        	<li><a href="{$entry.menu_url}">{$entry.menu_label} <img src="{$entry.menu_function_result}" alt="{$entry.menu_label}"></a></li>
        {/if}
    {else}
		{if $entry.menu_label == "Private Messages"}
       		{* CUSTOM CODE for pending followers in menu HERE *}
    		{if jrUser_is_logged_in()}
    			<li><a href="{$jamroom_url}/{$_user.profile_url}/follow">Pending Followers: {jrFollower_pending_count()}</a></li>
    		{/if}
		{/if}
    	<li><a href="{$entry.menu_url}">{$entry.menu_label}</a></li>
    {/if}
{/foreach}

hth


--
Paul Asher - JR Developer and System Import Specialist
Strumelia
Strumelia
@strumelia
4 years ago
3,602 posts
Hi Paul, thanks-
I had two pending followers on my FOTMD site, and the menu count correctly changed to "1", and then to "0", as i approved them one by one, while clearing cache between each approval. Once they were both approved, it now shows "0"... so it's working! :D
I applied the code change to my other JR site as well, and it's working again too.
Muchas gracias!


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015
Strumelia
Strumelia
@strumelia
4 years ago
3,602 posts
Oops, slight snag here...
Not sure why on my pennywhistle site, with the new code applied, my Strumelia account menu count shows "0", but clearly I do have 1 pending follower:
https://pennywhistleclub.com/strumelia/follow
(i did integ check and cleared cache several times, refreshed browser, also checked on both Chrome and FF browsers, no change)
Here's the updated code in my penny whistle site's custom skin Menu templ, looks the same to me as yours. ?:
{foreach from=$_items name="loop" item="entry"}
    {if isset($entry.menu_function_result) && strlen($entry.menu_function_result) > 0}
        {if is_numeric($entry.menu_function_result)}
        	<li><a href="{$entry.menu_url}">{$entry.menu_label} [{$entry.menu_function_result}]</a></li>
        {else}
        	<li><a href="{$entry.menu_url}">{$entry.menu_label} <img src="{$entry.menu_function_result}" alt="{$entry.menu_label}"></a></li>
        {/if}
    {else}
		{if $entry.menu_label == "Private Messages"}
       		{* CUSTOM CODE for pending followers in menu HERE *}
    		{if jrUser_is_logged_in()}
    			<li><a href="{$jamroom_url}/{$_user.profile_url}/follow">Pending Followers: {jrFollower_pending_count()}</a></li>
    		{/if}
		{/if}
    	<li><a href="{$entry.menu_url}">{$entry.menu_label}</a></li>
    {/if}
{/foreach}



--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015

updated by @strumelia: 10/01/20 05:05:35PM
paul
@paul
4 years ago
4,325 posts
Try it now. The fix also highlighted a small bug in the Follower module. I fixed it and patched FOTMD with the fix. I've now patched PWC as well.


--
Paul Asher - JR Developer and System Import Specialist
Strumelia
Strumelia
@strumelia
4 years ago
3,602 posts
That seems to have worked.
Thank you again Paul. :)


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015