Skip to content

Commit

Permalink
developing #149
Browse files Browse the repository at this point in the history
* added tempates for content or no content
* changed funcion to use new templates
  • Loading branch information
Sven committed Jun 23, 2018
1 parent 591cac2 commit 4946433
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
4 changes: 4 additions & 0 deletions inc/languages/english/thankyoulike.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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";
Expand Down Expand Up @@ -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'] = "<a href=\"{1}\">Searching {2}</a>";

$l['tyl_error'] = "Thank You/Like System Error Message";
Expand Down
27 changes: 18 additions & 9 deletions inc/plugins/thankyoulike.php
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,10 @@ function thankyoulike_install()
<tr>
<td colspan=\"2\" class=\"thead\"><strong>{\$lang->tyl_profile_box_thead}</strong></td>
</tr>
<tr>
{\$tyl_profile_box_content}
</table>
<br />",
'thankyoulike_member_profile_box_content' => "<tr>
<td class=\"tfoot\" width=\"80%\"><span class=\"smalltext\">{\$lang->tyl_profile_box_subject}</span></td>
<td class=\"tfoot\" width=\"20%\" align=\"center\"><span class=\"smalltext\">{\$lang->tyl_profile_box_number}</span></td>
</tr>
Expand All @@ -541,9 +544,10 @@ function thankyoulike_install()
</tr>
<tr>
<td class=\"trow1 scaleimages\" colspan=\"2\">{\$memprofile['tylmessage']}</td>
</tr>
</table>
<br />"
</tr>",
'thankyoulike_member_profile_box_content_none' => "<tr>
<td class=\"trow1\" colspan=\"2\">{\$lang->tyl_profile_box_content_none}</td>
</tr>"
);

foreach($tyl_templates as $template_title => $template_data)
Expand Down Expand Up @@ -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')
{
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -1544,12 +1551,14 @@ function thankyoulike_memprofile()
$memprofile['tylthreadname'] = "<a href=\"{$threadlink}\"><span>{$parser->parse_badwords($thread['subject'])}</span></a>";
$memprofile['tylforumname'] = "<a href=\"{$forumlink}\"><span>{$parser->parse_badwords($forum['name'])}</span></a>";

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
}
Expand Down

0 comments on commit 4946433

Please sign in to comment.