e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
321 stars 213 forks source link

Shortcodes can't render some links properly in forum post due to incorrect IDs, etc when using non-Bootstrap theme. #1290

Closed dimmskii closed 8 years ago

dimmskii commented 8 years ago

Post subject missing, polls missing, etc. They are missing, too, not just hidden due to CSS. I checked. On the other hand, including Bootstrap breaks the old 1.x themes. What do?

EDIT: Manually overriding the forum template, for example, and replacing the post style shortcodes like {SUBJECTBOX} with a concatenated .$subjectbox works. But why is it behaving like that?

LaocheXe commented 8 years ago

Bootstrap is just a theme, it has no influence with any e107 v 1.xx themes - I also don't quite understand what you are saying, you said a few elements are missing with a theme you are working on? Example the buttons are missing?

dimmskii commented 8 years ago

Yes, some don't work, etc. I managed to make the fields in new thread show up, but the quick reply button doesn't work. I have included JQuery into the theme, but still, no matter how much I add to my v1 theme, it's less functional than the Bootstrap one by far.

Correction: the quick reply works, it just doesn't refresh anything. However, I see some other jq stuff working quite well (sliding poll section, etc).

LaocheXe commented 8 years ago

Did you use the Theme Manager's convert old v1 themes to v2 before working on your version 1 theme?

dimmskii commented 8 years ago

Yes. AJAX quick reply still doesn't work (page doesn't refresh), etc. Is this not theme-related? In other words, do people on v2 with the default theme get any of these problems?

tgtje commented 8 years ago

As comment on last posted comment : overall issues with v1 themes do exist; but generally it is css related or 'size of boxes. The described other problems i have seldom seen being posted (as e107help org for source). Being a v1 theme, a 'free' one or premium (name? ). Most issues can be overcome when applying the recommended changes ( http://e107.org/developer-manual/theme-basics#upgrading-v1-x-themes ) Than again : is your forum template > normal or changed.. Using language (non english) ? if so how does english react..

dimmskii commented 8 years ago

Forum template changed as of now. V2 style (theme/templates/forum/*_template.php). I am getting rid some of the layout problems using this method. The theme is actually based off of sebes. I guess I could re-add the original banner and post the updated theme so v2 people can use it later. The posting problems might not be theme-related now that I think of it. Is there a special function for themes that handles page refreshing? I'm going to test out the Bootstrap theme and see how the quick reply reacts.

Quick edit: Just found out the issue is linked to the shortcodes generating wrong ID's. The funny thing is that the BS theme still works. I'm going to try and actually follow all of the suggest v2 templating changes, maybe somehow the PHP contexts are getting thrown off with the v1 method. If that's the case, I'm closing this one, as it is my fault.

dimmskii commented 8 years ago

Found it. Must be a problem with the {EDITIMG} shortcode when Bootstrap is not defined in theme.php

Problem? I guess so. Changed issue from using word Bootstrap-less to non-Bootstrap, cause 'less' can mean something else when talking about Bootstrap :P

So, to recap: {EDITIMG} gives a wrong edit link (thus resulting in 'Cannot post to this forum' error).

However, when I enable Bootstrap in my theme (anything > 0), the other method renders proper links (yet looks ugly, because my theme isn't using Bootstrap).

From the looks of it, the improper link to edit makes the &id= the post and &post= blank.

dimmskii commented 8 years ago

EDIT: Never mind, I don't advise this fix as it is working backwards. This change was done on purpose from what I have seen in some of the other forum code. See a few posts down.

~~Good news. I have made a fix that seems to work. Please check this: In e107/plugins/forum/forum_viewtopic.php, somewhere not far after line 1200:~~

Old code is commented out, new code is not commented, seems to work:

$ret .= "
        <div>
        <a href='" . $e107->url->create('forum/thread/edit', array('id' => $postInfo['post_thread'], 'post' => $postInfo['post_id']))."'>" . IMAGE_admin_edit . "</a>
        <input type='image' " . IMAGE_admin_delete . " name='delete{$type}_{$delId}' value='thread_action' onclick=\"return confirm_('{$type}', {$postInfo['post_forum']}, {$postInfo['post_thread']}, '{$postInfo['user_name']}')\" />
        <input type='hidden' name='mod' value='1'/>
        ";
    /*$ret .= "
        <div>
        <a href='" . $e107->url->create('forum/thread/edit', array('id' => $postInfo['post_id']))."'>" . IMAGE_admin_edit . "</a>
        <input type='image' " . IMAGE_admin_delete . " name='delete{$type}_{$delId}' value='thread_action' onclick=\"return confirm_('{$type}', {$postInfo['post_forum']}, {$postInfo['post_thread']}, '{$postInfo['user_name']}')\" />
        <input type='hidden' name='mod' value='1'/>
        ";*/
LaocheXe commented 8 years ago

how much have you tested on that? Does it still work with the Bootstrap theme? Does it work on other themes as well?

dimmskii commented 8 years ago

Haven't tested if my fix works on BS yet. I'm being rushed by a community with a 1.x theme conversion as I am GitHubbing here all at once :P I'll test it out in a bit more thoroughly.

EDIT: Bootstrap theme's Options > Edit Post still seems to work while my fix is in effect. I'm seeing a lot of if def bootstraps, so I'm guessing that the mod area/post options get rendered in some other code block for bootstrap themes (in a dropdown list). Keep in mind that I'm not using a debugger, eclipse, localhost, or anything. Just following code on the webserver, using FAR Manager to edit, lol. At least it has per-document syntax highlighting.

To be honest, there's no way around this fact: if my link was corrupted only during a bootstrap=0 theme, all bootstrap themes must use a completely different linkgen call for that dropdown menu. My guess is that this old edit button code was lost and unchecked as time went on with v2 dev.

Most important closing point: I have tried other v1 port themes such as Baba (it's on the e107v2 theme listing!). They all have similar issues with respect to forums, the edit button, fields not showing up in new thread, etc. These problems are definitely worth exploring in the near future. Or just drop legacy support altogether (please no :D).

dimmskii commented 8 years ago

I just realized something: my fix might not be proper. I was fixing the other oldschool image buttons, and found out that there is sometimes commented out code near the line which has the thread and post id's properly set. Why was this code changed? Anyways, my "fix" above is actually working backwards from whatever the plan seems to be. I don't advise it.