How to remove/change the value for breadcrumbs after creating a new Topic?

  • I am using nodebb in an iframe for my application. The architecture of the application is such that I have to show a specific category topics only in any certain view. Therefore I cannot show users the breadcrumbs in the "Topic" view. I have overcome this problem by overriding breadcrumbs.tpl in following way:

    <!-- IF breadcrumbs.length -->
    <ol class="breadcrumb">
    	<!-- BEGIN breadcrumbs -->
    	<li<!-- IF @last --> component="breadcrumb/current"<!-- ENDIF @last --> itemscope="itemscope" itemtype="" <!-- IF @last -->class="active"<!-- ENDIF @last -->>
    		<!-- IF !@last --><a href="{breadcrumbs.url}" itemprop="url"><!-- ENDIF !@last -->
    			<span itemprop="title">
    				<!-- IF @last -->
    				<!-- IF !feeds:disableRSS -->
    				<!-- IF rssFeedUrl --><a target="_blank" href="{rssFeedUrl}"><i class="fa fa-rss-square"></i></a><!-- ENDIF rssFeedUrl --><!-- ENDIF !feeds:disableRSS -->
    				<!-- ENDIF @last -->
    		<!-- IF !@last --></a><!-- ENDIF !@last -->
    	<!-- END breadcrumbs -->
    <!-- ENDIF breadcrumbs.length -->
    <!-- IF showCategoryLink -->
    <ol class="breadcrumb">
    	<li component="breadcrumb/current"itemscope="itemscope" >
    		<a href="{config.relativePath}/embed?category_id={cid}" itemprop="url">
    			<span itemprop="title">
    				Go Back
    			</s	an>
    <!-- ENDIF breadcrumbsAlternateLink -->

    and set the value for relevant variables (breadcrumbs=null and showCategoryLink=true by changing the controller for Topic.get).

    But the problem occurs when a user creates a new topic. Upon creation, the user is redirected to the Topic View that he has just created, and there are thumbnails being shown in that view.

    Is there anywhere that I can prevent those thumbnails from being shown? e.g.:

    • by avoiding that redirection and just creating the topic,
    • by using some plugin hook, If I could set the values for breadcrumbs and showCategoryLink as I want, or using the res object, I could redirect user to the view that I have overridden (i.e. /embed?category_id:<id>).
  • Admin Staff

    You can use the hook it will get called whenever a topic is loaded, you can set showCategoryLink to true/false in that hook.

  • Great . Exactly what I needed. Just couldn't find it in the documentation.

Suggested Topics

| |