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

Recent

Welcome to TinyPortal. Please login or sign up.

April 16, 2024, 07:15:46 PM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,161
  • Total Topics: 21,219
  • Online today: 106
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 60
  • Total: 60

Mini-Calendar Block Errors - TPsubs.template.php(635) 'profile_of' variable

Started by Michael Vail, April 13, 2022, 11:05:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Michael Vail

Link to my forum: https://sonomacountydsa.org/forums
SMF version: SMF ver. 2.1.1
TP version: 2.2.1
Default Forum Language: English
Theme name and version: Default Curve2 (using Curve2 Color Changer Mod)
Browser Name and Version: Chrome, Firefox, Edge - All Current Versions
Related Error messages:

/home/customer/www/sonomacountydsa.org/public_html/forums/Themes/default/TPsubs.template.php(635) : eval()'d code (Line 449)

8: Undefined index: profile_of

Current Server PHP Version: 7.4.27

Mods Installed: See attached package manager image

Greetings TP Staff and Friends,

My SMF 2.1.1 Error Log is flooded with the below errors and wanted to report them for review when you have time. My site it working fine but thought you should know about the issue in case it's something you would like to address at some point if it turns out to be a TP coding problem.

Error Message in SMF Error Log
QuoteMike Vail
66.62.93.98
d94c728061f5be8932d8e4816dae6151
https://www.sonomacountydsa.org/forums/index.php?
/home/customer/www/sonomacountydsa.org/public_html/forums/Themes/default/TPsubs.template.php(635) : eval()'d code (Line 449)

Type of error: Undefined
Error message Select
8: Undefined index: profile_of

Backtrace Error Report
QuoteType of error
Undefined_vars
Error message
8: Undefined index: profile_of
File
/home/customer/www/sonomacountydsa.org/public_html/forums/Themes/default/TPsubs.template.php(635) : eval()'d code
Line
449
URL of page causing the error
https://www.sonomacountydsa.org/forums/index.php?


Backtrace Information

    #0: smf_error_handler()
    Called from /home/customer/www/sonomacountydsa.org/public_html/forums/Themes/default/TPsubs.template.php(635) : eval()'d code on line 449
    #1: eval()
    Called from /home/customer/www/sonomacountydsa.org/public_html/forums/Themes/default/TPsubs.template.php on line 635
    #2: TPortal_phpbox()
    Called from /home/customer/www/sonomacountydsa.org/public_html/forums/Themes/default/TPsubs.template.php on line 148
    #3: TPblock()
    Called from /home/customer/www/sonomacountydsa.org/public_html/forums/Sources/TPortal.php on line 2048
    #4: TPortal_panel()
    Called from /home/customer/www/sonomacountydsa.org/public_html/forums/Themes/default/TPBlockLayout.template.php on line 103
    #5: template_tp_above()
    Called from /home/customer/www/sonomacountydsa.org/public_html/forums/Sources/Load.php on line 2748
    #6: loadSubTemplate()
    Called from /home/customer/www/sonomacountydsa.org/public_html/forums/Sources/Subs.php on line 4547
    #7: template_header()
    Called from /home/customer/www/sonomacountydsa.org/public_html/forums/Sources/Subs.php on line 4154
    #8: obExit()
    Called from /home/customer/www/sonomacountydsa.org/public_html/forums/index.php on line 190

Take care!

@rjen

Not sure what is going on. The information is a bit limited.

Line 449 of the file refers to the Theme selector block, but there is no 'profile_of' field called anywhere in the TP code.

Since you upgraded to SMF2.1 I suspect there is some issue with a theme somewhere. Perhaps it is calling an old 2.0 theme or something?

Question 1: do you have a theme selector block active?
If so try deactivating it and see if the errors go away.
If the do: check your themes: any outdates themes in the list? Try to remove / deacyivate those...

Question2: have you tried deactivating your blocks one by one to determine what block is giving the error?

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

tino

It looks like it is a custom PHP block causing the issue. So you'll have to review that code and correct it.

We can't control what is put in those.

Michael Vail

Thank you both for looking into this. I only have the default Curve2 theme installed and in use. I do not have the theme selector block enabled. I will turn off each of the blocks I have, one at a time, to isolate the issue. I'll report back with the findings so you know the outcome.

Thank you and happy Easter!
Mike

Oldiesmann

Do you have any custom PHP blocks? It sounds like that's what this is. The first error has absolutely nothing to do with the Theme Selector block at all.

".../TPSubs.template.php(635) : eval()'d code on line 449"

That means that the error occurred on line 449 of the code passed to eval() on line 635 of TPSubs.template.php.

Michael Vail

Hello,

Finally had time to track this down. The error is being caused by a line of code in my Mini Calendar TP Block.

Specifically, the birthday section below:

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 >= strftime('%Y-%m-%d', $low_date_ts)) && ($startdate <= 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[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>';
                  }
               }
            }
         }
      }
   }

According to a post I saw in the SMF website, the SMF "profile_of" variable used in this section was discontinued in SMF 2.1 RC4 and later versions. Apparently there's a new variable but I don't know what it is so I can replace it.

Does anyone know what I should replace the profile_of variable with so it works on the latest version of SMF without generating errors?

FYI, I revised the this thread's title to better list the issue for future searching.

Thank you...

Michael Vail

Looking for a little help from a coder here. God I wish I had the knowledge but I don't and have no time to learn it. I can do basic stuff but that's about it.

During my search for a resolution to the calendar block problem I was having on my calendar block, I saw a post from a mod author who had fixed a similar problem with his mod that was calling the user profiles to display.

In my case, the calendar mod I currently use is attempting a function related to displaying a member's birthday on the calendar and reporting errors each time the calendar is displayed because the profile variable used by the block has changed in SMF 2.1.1.

I wrote the mod author requesting help with fixing the issue and this is what he told me:

Quote
you could add it manually to the index.english.php file located in the language folder of your used theme

add it anywhere as long it's under the global var.

$txt['profile_of'] = 'profile of';

I have no idea what exactly he is asking me to do and he hasn't responded to my request to clarify what I need to do. It would seem a code change to the calendar block is all this is needed but he didn't offer that in his response. Can anyone tell me what I need to do to fix the code in the calendar block I use shown above using the info he related?

Any help would be appreciated.

Take care

@rjen

What you need to do is find the file index.english.php on your server (using FTP) in folder /Themes/default/languages

Download the file, open it with an editor (I would suggest Notepad++) and go to the end of the file and insert the string just before the ?> sign. (see attached example)

By the way the full string in SMF2.0 was this:
$txt['profile_of'] = 'View the profile of';

You can change the text 'View the profile of' to whatever you want to show, just make sure to leave the quotes..

Save the file, and upload the changed file back to the folder /Themes/default/languages
That should do it
Running Latest TP on SMF2.1 at: www.fjr-club.nl

Michael Vail

Thank you soooooo much @rjen! It's now working perfectly with no errors anymore!

For my own edification so I actually learn something from this, what does adding this string do? Am I just adding back a variable that previous versions of SMF had but was later removed? If so, why do the SMF devs remove variables like this from their code? I'm just trying to understand this so I can do a better job of resolving my own problems in the future.

I really appreciate all the help! Thanks for being there for us.

Have a great weekend my friend,
Mike

@rjen

Right, that variable was removed, but in SMF2.1 it is replaced with a new variable, that actually includes the username as a variable. That's why your cannot just use the new variable.
Running Latest TP on SMF2.1 at: www.fjr-club.nl

Michael Vail

Thank you @rjen, but version 3.2 of what? Sorry if I sound stupid.

@rjen

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