We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

cant find code for start new forum | Forum

dave Leader
dave Sep 12 '13

One of my largest requests from clients is "how do i start a new group forum"  so i had to add a help message at the top of the forum in order to explain how.

 

But this text sort of makes the page look funky.

 

So i set out to find the code that does the start new vew all button on the bottom of the group forum posts.  But so far it has eluded me.  I have followed the trail of the text, the css, but still it eludes me.   What i have gathered so far is that i believe this button is built from an array option

but i have not been able to find if it is comming from forum side or group side since i have my groups interfaced with forums in the group plugin settings.

 

Here is what i am trying to do, is just add the start new button to the top of the group forum page as well. People are getting tired of scrolling all the way to the bottom (which is quite long on some groups) to click the button.

 

 

i will keep looking but if anyone has done this or finds the code that i can copy and paste to the top as well thats great thanks. 

The Forum post is edited by dave Sep 12 '13
dave Leader
dave Sep 12 '13
I have followed the trail as far as box_toolbar.html  in ow_system_plugins/base/decorators but from there it eludes me again.  I was hoping it just had an include or something similar but nope the trail is cold again... grrr lol
Ebenezer Obasi
Ebenezer Obasi Sep 13 '13
Look in this file /ow_plugins/forum/controllers/add_topic.php
The Forum post is edited by Ebenezer Obasi Sep 13 '13
dave Leader
dave Sep 13 '13

Thanks yes i followed this before yesterday but this is were the link takes you not where it is displayed, at least i thought so.

 

However in this file there is this to set the breadcrumb value startng at line 112

 


            $bcItems = array(
                array(
                    'href' => OW::getRouter()->urlForRoute('group-default', array('groupId' => $forumGroup->getId())),
                    'label' => OW::getLanguage()->text($forumSection->entity, 'view_all_topics')
                )
            );

            $breadCrumbCmp = new BASE_CMP_Breadcrumb($bcItems);
            $this->addComponent('breadcrumb', $breadCrumbCmp);

 

 

But there has to be an html file that is assocatiated with this and i have not found that side of this as of yet.  The above might be the view all part of that button makeup.

The Forum post is edited by dave Sep 13 '13
dave Leader
dave Sep 13 '13
at the top of the /views/controllers/add_topic_index.html there is a breadcrumb value but that is the top menu box bar once your in the add page im sure, not the bottom one.
The Forum post is edited by dave Sep 13 '13
Daisy Team
Daisy Sep 19 '13
Dave, have you checked this file: /ow_system_plugins/base/views/components/breadcrumb.html?
dave Leader
dave Sep 19 '13
no Daisy but i will thanks i will let you know ;) 
dave Leader
dave Sep 21 '13
daisy i think that is the one at the top of the groups page with this info

"Created: May 28 · Admin: AnxAdmin · Edit · Unfollow "


im looking for the one on the bottom of that same page with this info

Start new View all


daisy, in ow_plugins/forum/controllers/group.php on the bottom you will find this

       else
        {
            $bcItems = array(
                array(
                    'href' => OW::getRouter()->urlForRoute('forum-default'),
                    'label' => OW::getLanguage()->text('forum', 'forum_index')
                ),
                array(
                    'href' => OW::getRouter()->urlForRoute('forum-default') . '#section-' . $groupInfo->sectionId,
                    'label' => $forumSection->name
                ),
                array(
                    'label' => $groupInfo->name
                )
            );

            $breadCrumbCmp = new BASE_CMP_Breadcrumb($bcItems);
            $this->addComponent('breadcrumb', $breadCrumbCmp);
        }

i think this breadcrumb is the one on the top of the group page that has this info. 
"Created: May 28 · Admin: AnxAdmin · Edit · Unfollow "

im not sure... but i still want the one on the bottom of that groups page


UPDATE:  I have narrowed it down to i feel the class or the call has to be in
ow_plugins/groups/controllers/groups.php  somewhere...

The Forum post is edited by dave Sep 21 '13
Daisy Team
Daisy Oct 1 '13
The breadcrumb on this page is « Back to group forum topic list value.

As far as I've understood you are talking about this line



If so, this line is not the breadcrumb. You can find the code for this line in the /ow_plugins/groups/components/brief_info_content.php file. Search for the $toolbar = array( string.
dave Leader
dave Oct 1 '13

Thanks Daisy, ill take a look at that also.  Yours looks dif than mine in text.   With every plugin comes a little menu on the bottom that says  Start new (or Add new or Create new) and  View all   Its in the groups, its in the plugin widgets that are on the main page.   The similar is used i believe site wide so it has to be a standard class or function, its used in the photo widget, groups widget, video widget, and others.  

 

Here is how i get to mine,  i click on groups, select a group, and its on the bottom of that page under the topic listings right hand corner.   Start new  View all

 

UPDATE:

 

I think i found it Daisy, at least the widget part of it..  You sparked something inside me and so i took a look at the groups_widget php file in ow_plugins/groups/components  and inside the static function getToolbar() i found this section. 

 


        if ( $canCreate )
        {
            $toolbars['latest'][] = array(
                'href' => OW::getRouter()->urlForRoute('groups-create'),
                'label' => $lang->text('groups', 'add_new')
            );
        }

        $toolbars['latest'][] = array(
            'href' => OW::getRouter()->urlForRoute('groups-latest'),
            'label' => $lang->text('base', 'view_all')
        );

        $toolbars['popular'] = array();

        if ( $canCreate )
        {
            $toolbars['popular'][] = array(
                'href' => OW::getRouter()->urlForRoute('groups-create'),
                'label' => $lang->text('groups', 'add_new')
            );
        }

        $toolbars['popular'][] = array(
            'href' => OW::getRouter()->urlForRoute('groups-most-popular'),
            'label' => $lang->text('base', 'view_all')
        );

 

im sure thats it... Now i just need to see if i can find the groups page side of this rather than the widget. Because the only files that call that function are groups widget, photo widget, video widget, an blog php.  So i seems there may be a diff function call for the groups page.  

The Forum post is edited by dave Oct 1 '13
Daisy Team
Daisy Oct 3 '13
I've finally got you.
You can find these buttons in the /ow_plugins/forum/components/latest_topics_widget.php file.

The fact is the position for these buttons was developed to be placed in the bottom right corner for all widgets in the core. So, the only way is to create a new buttons by adding the HTML code of these buttons directly in the widget template in /ow_plugins/forum/views/components/latest_topics_widget.html file.
The Forum post is edited by Daisy Oct 3 '13
dave Leader
dave Oct 3 '13

Thanks Daisy, your awesome !!!     

 

Yeah the more i looked at it last week the more it looked as it if was specifically parsed to build the botton of the page only as a whole.  I had a gut feeling i would either have to add my own function with the code or add it directly to the template file.

 

I really appreciate the help on this.. :)

dave Leader
dave Oct 4 '13

OK for anyone interested here is the change i did and it does seem to work. 

 

My original code grabbed the topic id and then added 1 to it for the add, but thank goodness there was a var set up for the addurl carried over from the php file so i just used that instead. 

 

But there was not one (var) for the viewall so i had to run thru the array one time to get the group id for the view all. 

 

So here is the code...   Daisy or anyone, if you see something i missed please reply. 

 

Remember i use the macabre theme..

 

open up   ow_plugins/forum/views/components/latest_topics_widget.html

 

first you will need to add some css to the top part of the file

 

SO AFTER THIS

 

.ow_forum_attachment_icon {
    background-repeat: no-repeat;
    cursor: pointer;
    display: inline-block;
    height: 17px;
    width: 14px;
}

 

ADD THIS

 

/* added for the new button above the topics */

.my_topbtnstyle {
       padding: 2px 7px;
      margin-top: 5px;
      font-size: 11px;
      float: right;
      white-space: nowrap;
      border-radius: 5px;
      -moz-border-radius: 5px;
      -webkit-border-radius: 5px;
       background-color: #252424;
       text-shadow: none;
       display: inline-block;
       color: #66ffff;   /* this is the same color as your remark text setting in admin theme setting */
}

 

NOW SAVE THE FILE FOR THIS STEP

 

OPEN THE FILE AGAIN

 

AFTER THIS

 

<div class="ow_forum_entity_forum clearfix ow_smallmargin">

 

ADD THIS

 

<!-- added this for top button -->
{if $topicList} 
         <!-- you just need the group id from the first result -->
        {foreach from=$topicList item=topvalue}        
         {$topgroupid = $topvalue.groupId}
          <!-- you got what you need so stop the foreach -->
          {break}
        {/foreach}

  {if $canAdd}
  <!-- set up the links -->       
  <span class="my_topbtnstyle">
  <!-- make sure you keep the blank spaces around the 8226 bullet symbol, they do parse -->
  <a href="{$addTopicUrl}">Start new</a> &#8226; <a href="{$site_url}/forum/{$topgroupid}">View all</a>

</span>
  <br />
  <br />
  {/if}

{/if}

<!-- end of add for top button -->

 

 

SAVE THE FILE

YOUR DONE !!!  :)  

 

now when you click on groups, then a group name, you should see a new menu above the topics listed, so that users do not have to go all the way to the bottom to use that menu.  If there are no postings the new menu will not show so there will be no errors or bad links.  The default core menu will be the only menu which is all you need on the bottom.

 

happy coding..

The Forum post is edited by dave Feb 2 '14
Daisy Team
Daisy Oct 4 '13
Dave, thank you for the solution.
dave Leader
dave Dec 31 '13

Daisy i will also send you a pm on this, i made a mistake and left out a close </a> after View All


It should be like this


<!-- set up the links -->       
  <span class="my_topbtnstyle">
<!-- make sure you keep the blank spaces around the 8226 bullet symbol, they do parse -->
  <a href="{$addTopicUrl}">Start new</a> &#8226; <a href="{$site_url}/forum/{$topgroupid}">View all </a>

  </span>


Right after the View all i forgot to close the anchor, I just discovered this error sorry... but works now just fine.  


thanks..