TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 195,855
  • Total Topics: 21,291
  • Online today: 1,422
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 341
  • Total: 341

TP ERROR: Undefined array key "profile_of" on TP 3.0.2 and SMF 2.1.6

Started by Michael Vail, August 14, 2025, 10:59:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Michael Vail

Link to my forum: http://www.sonomacountydsa.org/forums/
SMF version: 2.1.6
TP version: 3.0.2
Default Forum Language: English
Theme name and version: Default Curve
Browser Name and Version: Firefox, Chrome, Edge
Related Error messages:  Undefined array key "profile_of" (SEE ATTACHED LOG IMAGE)
Mods installed: SEE ATTACHED IMAGE

Greetings,

I have been running TP 3.0.2 on my SMF 2.1.6 forum for months. I recently installed a Google maps mod on my site but the mod didn't work correctly. With the maps mod installed, the SMF Profile button would just hang when members clicked it to edit their profile.  I did everything I could to resolve the issue including disabling all the mods installed on the forum.

After hours of trying things, and nothing working I ran the Large SMF 2.1.6 Upgrade on the site and reloaded all the mods. This fixed the map mod problem and everything appears to be  working fine. However, I'm now getting the log error Undefined array key "profile_of" when I move around the forum and go to the forum's TP home page. This was not happening prior to running the Large Upgrade and reinstalling the Mods. I'm hoping someone can take a look at this post and tell me what might be causing this new error.

Thank you for your time!


lurkalot

Michael, I've not seen that error before, but a quick search for that error on SMF support site mentions one mod that you have installed.  The avatar display integration mod.  Wonder f that's of some relevance.  Perhaps try uninstalling that mod and see if the error stops. 

@rjen

Based on the error it seems to me that this error is triggered wehen a certain block is rendered. To track it down you can try disabling blocks one by one and check if the message stops. The block you disabled will then be triggering the problem.

I suspect it is some mod that does something to profiles, and then the blocks to check are the ones that contain profile information.. i would suggest recent topics or user blocks.
You may also have custom coded blocks to check...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

Michael Vail

Thank you to both Lurkalot and Rjen. I tried removing the Avatar mod but the problem persisted so I uninstalled every SMF mod except TP. Still no go. I then disabled each TP block as Rjen suggested and found the error was being generated by the custom calendar block I've been using for 3+ years. What's bizarre is the log entries only began after running the SMF Large upgrade and reloading the mods on my forum.

The code section of the TP Calendar block that was generating the problem was this one:

Quote// BIRTHDAY SECTION
    if(($flag == 'B') && $show_bdays)
    {
        if($show_bdays_to_guests || !$user_info['is_guest'])
        {
            if (!empty($bdays))
            {
                echo '<tr'. (isset($list_label_class) ? ' class="'.$list_label_class.'"' : '') .'><td colspan="7" class="smalltext" align="center" style="font-weight: bold;">'.$list_label_bdays.'</td></tr>';
                $ctr = 0;

                foreach($bdays as $startdate => $bday_date)
                {
                    if (($startdate >= smf_strftime('%Y-%m-%d', $low_date_ts)) && ($startdate <= smf_strftime('%Y-%m-%d', $now + $modSettings['cal_days_for_index'] * 24 * 3600)))
                    {
                        foreach ($bday_date as $member)
                        {
                            $class_to_use = isset($list_entry_class) ? ( !is_array($list_entry_class) ? ' class="'.$list_entry_class.'"' : ' class="'.$list_entry_class[($ctr++) % count($list_entry_class)].'"') : '';
                            $birthdate = strtotime($startdate);
                            $text_start = !isset($month_nam['12']) ? date("M j",$birthdate) : substr($month_nam[smf_strftime('%m', $birthdate)],0,3) . date(" j",$birthdate);

                            echo '<tr'.$class_to_use.'><td colspan="7" class="smalltext" style="padding: 0px 0px 0px 0px;" width="100%" align="'.$align_list_entries.'">';
                            echo '<a href="', $scripturl, '?action=calendar;year=' . date("Y") . ';month=' . substr($startdate,5,2) . '">' . $text_start . ':</a> ';
                            echo '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '" title="' . $txt['profile_of'] . ' ' . $member['name'] . '">' . '<span class="'.$hilite_bday_class.'">' . ( ($nowdate == $startdate) ? '' : '') . $member['name'] . (isset($member['age']) ? '(' . $member['age'] . ')' : '') . ( ($nowdate == $startdate) ? '' : '') . '</span>' . '</a>';
                            echo '</td></tr>';
                        }
                    }
                }
            }
        }
    }

On a whim, I changed the code from 'profile_of' to 'profile' and the errors stopped. I tried to get more info on this variable but found little info that helped. Perhaps it's deprecated in SMF 2.1.6 or PHP 8.0+??? I don't even know if the replacement I used is correct, but it doesn't generate errors and the block still appears to do what it's suppose to do, so I guess it's correct?

On a side note, I had created an nearly identical forum with the same plugins and versions to isolate the issue. Upon using the exact same Calendar block code on the test site on the same server and same conditions, I do not get the profile_of errors but do get an Undefined array key "time_offset" instead when displaying the same calendar block! I don't get it!  As with the other forum, the block works as intended, it just displays the time_offset errors in the log every time the calendar block is displayed. The code for that section is below:

Quote// use forum's date/time
// include user's time offset to forum date/time
$now = time() + (($user_info['time_offset'] + $modSettings['time_offset']) * 3600);

Just curious if you have any idea why this strange error behavior for two different arrays are occurring and only on one similar forum to the other? Are both the variables deprecated now? Why is only one forum displaying each error in the log and not both errors?

If you have an ideas, I'd love to know to satisfy my curiosity.

Warm Regards and thank you for the help!


@rjen

Just some explanation:
these $txt stings are the language text that are found in the language files in SMF. If you use a $txt string like $txt['profile_of'] in your custom block code this must be loaded as part of the language files in your forum.
You were using an SMF txt string in your block that got removed in a later version of SMF, that's what caused the 'undefined' errors...

The profile_of text was removed from SMF after RC4 I believe.
I assume it was working before because you upgraded with patches. The string must have still been in the language files. When you refreshed the data it was apparently gone...

By the way, using text string  $txt['profile'] = 'Profile'; will change the displayed text in you block.
Instead of  "Profile of Username" it will now show "Profile Username"

You can also keep using your custom block if you add the txt string to your Modifications.english.php file.
Just add:  $txt['profile_of'] = 'Profile of';

Edit:
I just noticed you already reported the exact same issue here in 2022 and fixed it yourself: https://www.tinyportal.net/index.php?topic=36753.msg302400#msg302400

This fix you have now overwritten when you replaced all files with the original ones...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

@rjen

As for the time offset I would suggest checking the user settings in both forums. I suspect in your test forum the user does not have a time offset set: if you are not checking the variable for being maintained in the code, an empty variable will result in this error
Running Latest TP on SMF2.1 at: www.fjr-club.nl

Michael Vail

Thank you Rjen! I'm getting old!!!!

Those responses really help and totally make sense. Much appreciated!

Is there somewhere online I can find which and when variables are removed from SMF versions? The public changelogs I've seen posted when SMF is updated haven't shown that level of detail.

Have a great weekend!

@rjen

Running Latest TP on SMF2.1 at: www.fjr-club.nl

This website is proudly hosted on Crocweb Cloud Website Hosting.