MyBB Community Forums

Full Version: [Patch+Docs] Reddit Thread Style for MyBB
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
---=== This is work in progress! ===----
---=== Please always read my latest post for the most recent version ===----



In case you are interested to add functionality to MyBB so it shows threads in the Reddit style,
I'd like to share my work.

See attached image "mybbredditstyle" for how it looks in this very early stage.
[Image: attachment.php?aid=37203]
I had to modify two php files, showthread.php and inc/functions_post.php and to add a few templates.

New template "postbit_threaded":
{$ignore_bit}
<table style="width:100%" border="0" cellpadding="0" cellspacing="0" >
<tr>
 <td width="{$indentsize}%"></td>
 
 <td>
 <table style="width:100%" border="0" cellspacing="0" cellpadding="0" class="tborder">
 <tr>

<td id="posts_container">
 <div id="posts">

 
<a name="pid{$post['pid']}" id="pid{$post['pid']}"></a>
<div class="post {$unapproved_shade}" style="{$post_visibility}" id="post_{$post['pid']}">
<div class="post_author">
 {$post['useravatar']}
 <div class="author_information">
 <strong><span class="largetext">{$post['profilelink']}</span></strong> {$post['onlinestatus']}<br />
 <span class="smalltext">
 {$post['usertitle']}<br />
 {$post['userstars']}
 {$post['groupimage']}
 </span>
 </div>
 <div class="author_statistics">
 {$post['user_details']}
 </div>
</div>
<div class="post_content">
 <div class="post_head">
 {$post['posturl']}
 {$post['icon']}
 <span class="post_date">{$post['postdate']} <span class="post_edit" id="edited_by_{$post['pid']}">{$post['editedmsg']}</span></span>
 {$post['subject_extra']}
 </div>
 <div class="post_body scaleimages" id="pid_{$post['pid']}">
 {$post['message']}
 </div>
 {$post['attachments']}
 {$post['signature']}
 <div class="post_meta" id="post_meta_{$post['pid']}">
 {$post['iplogged']}
 </div>
</div>
<div class="post_controls">
 <div class="postbit_buttons author_buttons float_left">
 {$post['button_email']}{$post['button_pm']}{$post['button_www']}{$post['button_find']}{$post['button_rep']}
 </div>
 <div class="postbit_buttons post_management_buttons float_right">
 {$post['button_edit']}{$post['button_quickdelete']}{$post['button_quickrestore']}{$post['button_quote']}{$post['button_multiquote']}{$post['button_report']}{$post['button_warn']}{$post['button_purgespammer']}{$post['button_reply_pm']}{$post['button_replyall_pm']}{$post['button_forward_pm']}{$post['button_delete_pm']}
 </div>
</div>
</div>
</div>
 
 </td>
 </tr>
 </table>

 
</td>
</tr>
</table>


New template showthread_threaded:
<html>
<head>
<title>{$thread['subject']}</title>
{$headerinclude}
<script type="text/javascript">
<!--
 var quickdelete_confirm = "{$lang->quickdelete_confirm}";
 var quickrestore_confirm = "{$lang->quickrestore_confirm}";
 var allowEditReason = "{$mybb->settings['alloweditreason']}";
 lang.save_changes = "{$lang->save_changes}";
 lang.cancel_edit = "{$lang->cancel_edit}";
 lang.quick_edit_update_error = "{$lang->quick_edit_update_error}";
 lang.quick_reply_post_error = "{$lang->quick_reply_post_error}";
 lang.quick_delete_error = "{$lang->quick_delete_error}";
 lang.quick_delete_success = "{$lang->quick_delete_success}";
 lang.quick_delete_thread_success = "{$lang->quick_delete_thread_success}";
 lang.quick_restore_error = "{$lang->quick_restore_error}";
 lang.quick_restore_success = "{$lang->quick_restore_success}";
 lang.editreason = "{$lang->postbit_editreason}";
// -->
</script>
<!-- jeditable (jquery) -->
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/report.js?ver=1804"></script>
<script src="{$mybb->asset_url}/jscripts/jeditable/jeditable.min.js"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/thread.js?ver=1804"></script>
</head>
<body>
 {$header}
 {$threadnotesbox}
 {$pollbox}
 <div class="float_left">
 {$multipage}
 </div>
 <div class="float_right">
 {$newreply}
 </div>
 {$ratethread}
 <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder tfixed clear">
 <tr>
 <td class="thead">
 <div class="float_right">
 <span class="smalltext"><strong><a href="javascript:;" id="thread_modes">{$lang->thread_modes}</a>{$threadnoteslink}</strong></span>
 </div>
 <div>
 <strong>{$thread['threadprefix']}{$thread['subject']}</strong>
 </div>
 </td>
 </tr>

 {$posts}

 <tr>
 <td class="tfoot">
 {$search_thread}
 <div>
 <strong>&laquo; <a href="{$next_oldest_link}">{$lang->next_oldest}</a> | <a href="{$next_newest_link}">{$lang->next_newest}</a> &raquo;</strong>
 </div>
 </td>
 </tr>
 </table>
 <div class="float_left">
 {$multipage}
 </div>
 <div style="padding-top: 4px;" class="float_right">
 {$newreply}
 </div>
 <br class="clear" />
 {$quickreply}
 {$threadexbox}
 {$similarthreads}
 <br />
 <div class="float_left">
 <ul class="thread_tools">
 <li class="printable"><a href="printthread.php?tid={$tid}">{$lang->view_printable}</a></li>
 {$sendthread}
 <li class="subscription_{$add_remove_subscription}"><a href="usercp2.php?action={$add_remove_subscription}subscription&amp;tid={$tid}&amp;my_post_key={$mybb->post_code}">{$add_remove_subscription_text}</a></li>
 {$addpoll}
 </ul>
 </div>

 <div class="float_right" style="text-align: right;">
 {$moderationoptions}
 {$forumjump}
 </div>
 <br class="clear" />
 {$usersbrowsing}
 {$footer}
 <div id="thread_modes_popup" class="popup_menu" style="display: none;"><div class="popup_item_container"><a href="showthread.php?mode=linear&amp;tid={$tid}&amp;pid={$pid}#pid{$pid}" class="popup_item">{$lang->linear}</a></div><div class="popup_item_container"><a href="showthread.php?mode=threaded&amp;tid={$tid}&amp;pid={$pid}#pid{$pid}" class="popup_item">{$lang->threaded}</a></div></div>
 <script type="text/javascript">
 // <!--
 if(use_xmlhttprequest == "1")
 {
 $("#thread_modes").popupMenu();
 }
 // -->
 </script>
 <script type="text/javascript">
 $(".author_avatar img").error(function () {
 $(this).unbind("error").closest('.author_avatar').remove();
 });
 </script>
</body>
</html>

Please be aware that I never before programmed in PHP until today and so my program changes are probably very clumsy.
This is work in progress. Files are not yet cleaned/polished up. Updates follow soon.

TBD:
  • Make separate user title templates for threaded view (flatter appearance -> more messages on screen)
  • Fix the post function (should order in new post correctly in threaded view also without refreshing page)
  • Round the corners somewhat, making the whole stuff look less boxy, and other fine-polishing
  • Highlight new messages
P.S.:
Whatever I try to upload the source, be it in plain text or compressed, I get the notice "Sorry, you have been blocked." This sucks balls. Any idea what to do?

P.S.2:
I just put the sources onto pastebin:
showthread.php: http://pastebin.com/fp1fEaAA
inc/functions_post.php: http://pastebin.com/MtqePKpx

Edit #3: It's real fun to play with MyBB. Installed just a few days ago and modded it today. I like it!   Smile
Thanks for your contribution. Very nice job. I don't know how is gonna look in the late discussion with a lot of quotations for example...

Yeah, the Forum system in general (not only MyBB) need a better layout than tradicional forums.

It's a no turning back point at this moment, if we want to compete with social networks.

It's the only good thing that social networks are better than forums: A better reading/understanding the discussion in the thread/post.

We need a more friendly layout for reading, specially in this lazy times that our society is passing through.
Good luck with this, looks interesting Smile
Screenshot of the current development state:

[Image: attachment.php?aid=37347]

You see that new messages are being highlighted (red border).
Message nesting is done by indentation from both sides, decreasing with indentation levels..
Nesting contrast is increased by darker shades at deeper nesting levels.
Much unnecessary information that only wasted screen space has been stripped.

For example, nobody needs avatars, postcounts etc that only waste valuable screen space. This is cruft from the web's stone ages, when programmers wanted to do things just because they became technically possible. Displaying such things should be optional, not mandatory.

There are still a few minor/cosmetic issues left like the exact vertical positioning of the "Report" buttons etc.

Probably I'll overhaul the linear thread view in a similar manner in a later stage, as it looks like a chaotic mess compared to the modern view.

After I did these fine-tunings and some more testing I'll upload the code and the templates in a later post.
Very cool. I'm actually interested in implementing something like this to my board. Want to work on the project together? I can help with PHP and design ideas.
can this be implanted on any theme or just default theme?
(2016-09-18, 06:23 PM)Tactrus Wrote: [ -> ]Want to work on the project together? I can help with PHP and design ideas.

You are very welcome!
Would be great if this could become a collaborative project!

On GitHub I set up a project page.
There you can download the most recent sources.

(2016-09-18, 07:02 PM)leroymcqy Wrote: [ -> ]can this be implanted on any theme or just default theme?
I expect it to work with most, if not all themes. Will test when finished with the basic functionality.
However, there are some new properties that are not in the default theme. Like background color, gradient, indentation depth. These must be tailored to one's individual taste.
(2016-09-18, 07:11 PM)Schrotti Wrote: [ -> ]
(2016-09-18, 06:23 PM)Tactrus Wrote: [ -> ]Want to work on the project together? I can help with PHP and design ideas.

You are very welcome!
Would be great if this could become a collaborative project!

On GitHub I set up a project page.
There you can download the most recent sources.

(2016-09-18, 07:02 PM)leroymcqy Wrote: [ -> ]can this be implanted on any theme or just default theme?
I expect it to work with most, if not all themes. Will test when finished with the basic functionality.
However, there are some new properties that are not in the default theme. Like background color, gradient, indentation depth. These must be tailored to one's individual taste.


i did what you said to do, and its doesnt look like yours.

any settings i need or css i need to make?

it just shows it like it normally does.

after using the github files it works. apparently the pastebins don't work as it should.

p.s: change the view of threads into threaded not linear for this to work.

it doesn't like classic bit either.

also you can't select posts or threads to perm delete you can only soft delete them.

thought i let you know.
(2016-09-18, 07:57 PM)leroymcqy Wrote: [ -> ]after using the github files it works. apparently the pastebins don't work as it should.

Yes, the pastebins are obsoleted.

(2016-09-18, 07:57 PM)leroymcqy Wrote: [ -> ]p.s: change the view of threads into threaded not linear for this to work.
Very important, I forgot to mention this!

(2016-09-18, 07:57 PM)leroymcqy Wrote: [ -> ]it doesn't like classic bit either.
Can you explain what you meant? I am not sure whether I understood you correctly...

(2016-09-18, 07:57 PM)leroymcqy Wrote: [ -> ]also you can't select posts or threads to perm delete you can only soft delete them.

thought i let you know.
With your feedback you actively help sort out bugs and other issues!
Thank you very much!
I will look after that issue!
(2016-09-18, 08:12 PM)Schrotti Wrote: [ -> ]
(2016-09-18, 07:57 PM)leroymcqy Wrote: [ -> ]it doesn't like classic bit either.
Can you explain what you meant? I am not sure whether I understood you correctly...

it doesn't like classic bit at all. as for the no selection of posts, it could of been my theme to. gonna test it here in a little bit with default theme.

it was due to the old coding i used.

ps: idk if you plan on releasing a style to it but it would be nice if it did have one lol.

unfort when you edit the post, it doesn't show the edit buttons
Pages: 1 2