From 494643338df6479fb197926b35f6c035e2782220 Mon Sep 17 00:00:00 2001 From: Sven Date: Sat, 23 Jun 2018 19:50:08 +0200 Subject: [PATCH] developing #149 * added tempates for content or no content * changed funcion to use new templates --- inc/languages/english/thankyoulike.lang.php | 4 +++ inc/plugins/thankyoulike.php | 27 ++++++++++++++------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/inc/languages/english/thankyoulike.lang.php b/inc/languages/english/thankyoulike.lang.php index 8cb81cd..b61a801 100644 --- a/inc/languages/english/thankyoulike.lang.php +++ b/inc/languages/english/thankyoulike.lang.php @@ -6,6 +6,7 @@ $l['tyl_thankyou'] = "Thank You"; $l['tyl_thanked'] = "Thanked"; +$l['tyl_thanked_sm'] = "thanked"; $l['tyl_thanks'] = "Thanks"; $l['tyl_thanks_given'] = "Thanks Given"; $l['tyl_thanks_rcvd'] = "Thanks Received"; @@ -16,6 +17,7 @@ $l['tyl_likes_rcvd'] = "Likes Received"; $l['tyl_likes_rcvd_bit'] = "{1} in {2} posts"; $l['tyl_liked'] = "Liked"; +$l['tyl_liked_sm'] = "liked"; $l['tyl_users'] = "users"; $l['tyl_user'] = "user"; @@ -59,6 +61,8 @@ $l['tyl_profile_box_thread'] = "Thread Subject"; $l['tyl_profile_box_forum'] = "Forum Name"; +$l['tyl_profile_box_content_none'] = "Sorry, {1} has no {2} post at the moment."; + $l['tyl_wol_searching'] = "Searching {2}"; $l['tyl_error'] = "Thank You/Like System Error Message"; diff --git a/inc/plugins/thankyoulike.php b/inc/plugins/thankyoulike.php index 46e0414..6188a33 100644 --- a/inc/plugins/thankyoulike.php +++ b/inc/plugins/thankyoulike.php @@ -514,7 +514,10 @@ function thankyoulike_install() {\$lang->tyl_profile_box_thead} - +{\$tyl_profile_box_content} + +
", + 'thankyoulike_member_profile_box_content' => " {\$lang->tyl_profile_box_subject} {\$lang->tyl_profile_box_number} @@ -541,9 +544,10 @@ function thankyoulike_install() {\$memprofile['tylmessage']} - - -
" +", + 'thankyoulike_member_profile_box_content_none' => " +{\$lang->tyl_profile_box_content_none} +" ); foreach($tyl_templates as $template_title => $template_data) @@ -900,7 +904,7 @@ function thankyoulike_templatelist() } if (THIS_SCRIPT == 'member.php') { - $template_list = "thankyoulike_member_profile,thankyoulike_member_profile_box"; + $template_list = "thankyoulike_member_profile,thankyoulike_member_profile_box,thankyoulike_member_profile_box_content,thankyoulike_member_profile_box_content_none"; } if (THIS_SCRIPT == 'announcements.php') { @@ -1466,19 +1470,22 @@ function thankyoulike_memprofile() // Member Profile Box Start if($mybb->settings[$prefix.'show_memberprofile_box'] != 0) { - global $theme, $tyl_profile_box; + global $theme, $tyl_profile_box, $tyl_profile_box_content; + $tyl_profile_box = $tyl_profile_box_content = ""; if($mybb->settings[$prefix.'thankslike'] == "like") { $lang->tyl_profile_box_thead = $lang->sprintf($lang->tyl_profile_box_thead, $memprofile['username'], $lang->tyl_liked); $lang->tyl_profile_box_number = $lang->sprintf($lang->tyl_profile_box_number, $lang->tyl_likes); + $lang->tyl_profile_box_content_none = $lang->sprintf($lang->tyl_profile_box_content_none, $memprofile['username'], $lang->tyl_liked_sm); } elseif($mybb->settings[$prefix.'thankslike'] == "thanks") { $lang->tyl_profile_box_thead = $lang->sprintf($lang->tyl_profile_box_thead, $memprofile['username'], $lang->tyl_thanked); $lang->tyl_profile_box_number = $lang->sprintf($lang->tyl_profile_box_number, $lang->tyl_thanks); + $lang->tyl_profile_box_content_none = $lang->sprintf($lang->tyl_profile_box_content_none, $memprofile['username'], $lang->tyl_thanked_sm); } - + $unviewwhere = ''; $unviewable = get_unviewable_forums(true); if($unviewable) @@ -1544,12 +1551,14 @@ function thankyoulike_memprofile() $memprofile['tylthreadname'] = "{$parser->parse_badwords($thread['subject'])}"; $memprofile['tylforumname'] = "{$parser->parse_badwords($forum['name'])}"; - eval("\$tyl_profile_box = \"".$templates->get("thankyoulike_member_profile_box")."\";"); + eval("\$tyl_profile_box_content = \"".$templates->get("thankyoulike_member_profile_box_content")."\";"); } else { - $tyl_profile_box = ""; + eval("\$tyl_profile_box_content = \"".$templates->get("thankyoulike_member_profile_box_content_none")."\";"); } + + eval("\$tyl_profile_box = \"".$templates->get("thankyoulike_member_profile_box")."\";"); } // Member Profile Box End }