Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

August 12, 2022, 08:38:45 AM

Login with username, password and session length
Members
  • Total Members: 3842
  • Latest: Kokoro
Stats
  • Total Posts: 193479
  • Total Topics: 21088
  • Online today: 50
  • Online ever: 1035
  • (November 26, 2020, 04:45:12 AM)
Users Online
Users: 0
Guests: 45
Total: 45

Author Topic: Mini-Calendar Block Errors - TPsubs.template.php(635) 'profile_of' variable  (Read 566 times)

0 Members and 1 Guest are viewing this topic.

Offline Michael Vail

  • Jr. Member
  • **
  • Posts: 37
    • Sonoma County DSA
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
Quote
Mike 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
Quote
Type 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!
« Last Edit: April 26, 2022, 07:53:02 PM by Mike Vail »

Offline @rjen

  • Support Team
  • *
  • Posts: 3285
    • FJR-club Nederland
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

Testing TP on SMF2.0
Testing TP on SMF2.1 (latest Github)
Want to check what php version I am testing on? See: PHP Info

Offline tino

  • Developer
  • *
  • Posts: 2613
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.

Offline Michael Vail

  • Jr. Member
  • **
  • Posts: 37
    • Sonoma County DSA
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

Offline Oldiesmann

  • Jr. Member
  • **
  • Posts: 48
    • Cincy Space
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.

Offline Michael Vail

  • Jr. Member
  • **
  • Posts: 37
    • Sonoma County DSA
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) . '"><strong>' . $text_start . ':</strong>[/url] ';
                     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>' . '[/url]';
                     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...
« Last Edit: May 06, 2022, 08:45:59 PM by Michael Vail »

Offline Michael Vail

  • Jr. Member
  • **
  • Posts: 37
    • Sonoma County DSA
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

Offline @rjen

  • Support Team
  • *
  • Posts: 3285
    • FJR-club Nederland
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

Testing TP on SMF2.0
Testing TP on SMF2.1 (latest Github)
Want to check what php version I am testing on? See: PHP Info

Offline Michael Vail

  • Jr. Member
  • **
  • Posts: 37
    • Sonoma County DSA
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

Offline @rjen

  • Support Team
  • *
  • Posts: 3285
    • FJR-club Nederland
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.
« Last Edit: May 07, 2022, 11:22:22 PM by @rjen »
Running Latest TP on SMF2.1 at: www.fjr-club.nl

Testing TP on SMF2.0
Testing TP on SMF2.1 (latest Github)
Want to check what php version I am testing on? See: PHP Info

Offline Michael Vail

  • Jr. Member
  • **
  • Posts: 37
    • Sonoma County DSA
Thank you @rjen, but version 3.2 of what? Sorry if I sound stupid.

Offline @rjen

  • Support Team
  • *
  • Posts: 3285
    • FJR-club Nederland
SMF 2.1. , sorry typing on my phone …
Running Latest TP on SMF2.1 at: www.fjr-club.nl

Testing TP on SMF2.0
Testing TP on SMF2.1 (latest Github)
Want to check what php version I am testing on? See: PHP Info