Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product
After February 6, this site will no longer have Facebook, Twitter, or OpenID sign-in options. Read our announcement about social media SSO support in 2.8 for more info.

Make sure you have a current, valid email address set in your profile and set a password so you can login without it. If you get locked out after that time, you can choose "Forgot Password" to fix it as long as a valid email is on your account.
Please upgrade to 2.3 here. The 2.2 and earlier branches are no longer being updated.

Images missing

This discussion is related to the YagaDiscussionHeaderBadges addon.

Hello, i installed the plugin but i have no images as this pic shows:
thanks for your help.

Comments

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    Replace the code of the class.yagadiscussionheaderbadges.plugin.php
    with this and report back if that worked.

    class YagaDiscussionHeaderBadgesPlugin extends Gdn_Plugin {
    
      /**
        * Base_Render_Before Event Hook
        *
        * This is a common hook that fires for all controllers (Base), on the Render method (Render), just 
        * before execution of that method (Before). It is a good place to put UI stuff like CSS and Javascript 
        * inclusions. Note that all the Controller logic has already been run at this point.
        *
        * @param $Sender Sending controller instance
        */
      public function Base_Render_Before($Sender){
        $Sender->AddCssFile($this->GetResource('design/badges.css', FALSE, FALSE));
      }
    
      public function DiscussionController_AuthorInfo_Handler($Sender, $Args) {
            // Get the user object from the controller, I am just guessing with this line
        $UserID = $Sender->EventArguments['Author']->UserID;
    
        $BadgeAwardModel = Yaga::BadgeAwardModel();
            $Badges = $BadgeAwardModel->GetByUser($UserID);
    
        foreach($Badges as $Badge) {
            echo Anchor(Img($Badge['Photo']),'badges/detail/' . $Badge['BadgeID'] . '/' .Url($Badge['Name']),array('title' => $Badge['Name']),array('class' => 'DiscussionHeaderBadge'));
          }
         }
    }
    
    hgtonight
  • Hi, thank you for your reply. I replaced what you posted:

    but nothing here the output:

  • hgtonighthgtonight ∞ · New Moderator

    Yaga requires pretty links (but I am looking to remove that requirement). Enabling pretty links will fix future activity images from Yaga. Once you get that working, you will have to update your activity table to remove the incorrect images for existing activity items.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

    vrijvlinder
  • @hgtonight said:
    Yaga requires pretty links (but I am looking to remove that requirement). Enabling pretty links will fix future activity images from Yaga. Once you get that working, you will have to update your activity table to remove the incorrect images for existing activity items.

    @hgtonight thanks! but sorry what i have to do now to fix this issue?

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
  • RiverRiver MVP
    edited July 2016

    @hgtonight said:
    Yaga requires pretty links (but I am looking to remove that requirement).

    thats odd, and may not be worth the effort, since pretty urls are pretty much required to work properly for most other things.

    Vanilla will be enforcing this requirement. :)

    from the vanilla documentation...
    The ability to use non-pretty URLs may be deprecated in the future.

    @Teo said:

    @hgtonight said:
    Yaga requires pretty links (but I am looking to remove that requirement). Enabling pretty links will fix future activity images from Yaga. Once you get that working, you will have to update your activity table to remove the incorrect images for existing activity items.

    @hgtonight thanks! but sorry what i have to do now to fix this issue?

    You have to change to pretty urls.

    from the OFFICIAL documentation which is pretty sparse and not very helpful.....

    Pretty URLs
    
    All requests are dispatched thru the index.php file. While it’s possible to use the framework by passing a ‘p’ parameter with the rest of the path (e.g. /index.php?p=/profile), it’s best to configure your server to handle “pretty” URLs.
    
    On Apache, this is accomplished with the .htaccess file provided with Vanilla that contains these rewrite rules:
    
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php\?p=$1 [QSA,L]
    
    Consult the community if you need assistance configuring another server platform such as nginx or IIS.
    
    Vanilla will attempt to detect whether your system can handle pretty URLs during installation. If it sets it incorrectly, the config setting to enable pretty URLs is:
    
    $Configuration['Garden']['RewriteUrls'] = TRUE;
    

    http://docs.vanillaforums.com/developer/framework/controllers/

    Pretty Urls require the above config statement.

    You have to know if you use Apache IIS or nginx as your wb server. Ask your host.
    if you use apache. see this to use pretty urls.

    https://vanillaforums.org/discussion/comment/220157/#Comment_220157

    Once you have urls that are pretty -

    you will need to manually fix links in the activity table. as stated above

    Once you get that working, you will have to update your activity table to remove the incorrect images for existing activity items. by physically changing the items.

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

    vrijvlinderTeo
  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    The htaccess file needs to look like this for open source . The default one has #RewriteBase / disabled.

    # Modified
    # If you modify this file then change the above line to: # Modified
    <IfModule mod_rewrite.c>
       RewriteEngine On
       # Certain hosts may require the following line.
       # If vanilla is in a subfolder then you need to specify it after the /. 
       # (ex. You put Vanilla in /forum so change the next line to: RewriteBase /forum)
       RewriteBase /thenameofmysubdirectoryif there is one otherwise just the /
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteRule ^(.*)$ index.php\?p=$1 [QSA,L]
    </IfModule>
    
  • TeoTeo New
    edited July 2016

    Hello guys, thanks for your tip, I'm the host of my websites is not the only one i have online all are under my VPS CentOS 6.8 (httpd + mysqld + nginx) and honestly i'm not going to modify the webserver for such things, you can understand.. I thought it was easier... :/

    @vrijvlinder said:
    Post the contents of the htaccess file please

    # Original
    # If you modify this file then change the above line to: # Modified
    <IfModule mod_rewrite.c>
       RewriteEngine On
       # Certain hosts may require the following line.
       # If vanilla is in a subfolder then you need to specify it after the /.
       # (ex. You put Vanilla in /forum so change the next line to: RewriteBase /forum)
       RewriteBase /forum
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteRule ^(.*)$ index.php\?p=$1 [QSA,L]
    </IfModule>
    
  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    @Teo said:
    Hello guys, thanks for your tip, I'm the host of my websites is not the only one i have online all are under my VPS and honestly i'm not going to modify the webserver for such things, you can understand.. I thought it was easier... :/

    It should be relatively easy. The answer was somewhat hidden between misplaced criticism above:

    @River said:
    $Configuration['Garden']['RewriteUrls'] = TRUE;

    Add this to your /conf/config.php and you should have "pretty urls" enabled.

    As @hgtonight pointed out, there would be another step needed: you would have to do a search and replace in your database. That is something that is not supported, so you would have to export table GDN_Activity do a search & replace for "/index.php?p=" and replace it with "" ( = empty, so that it would be removed). Afterwards you should do a "TRUNCATE TABLE GDN_Activity" in order to delete all the entries in the Activity table and kind of "reset" it and re-import what you have exported and corrected.

    Be aware that every activity that is written between your export and your import would be lost that way. So do it only that way if you a) lock your forum for that time or b) don't have high frequency and don't care about that loss.

    There are other ways to achieve the same, but they require more steps.

    whu606
  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited July 2016

    @Teo said:
    Hello guys, thanks for your tip, I'm the host of my websites is not the only one i have online all are under my VPS CentOS 6.8 (httpd + mysqld + nginx) and honestly i'm not going to modify the webserver for such things, you can understand.. I thought it was easier... :/

    It is but we had little info to work with .

    # Original
    # If you modify this file then change the above line to: # Modified
    <IfModule mod_rewrite.c>
       RewriteEngine On
       # Certain hosts may require the following line.
       # If vanilla is in a subfolder then you need to specify it after the /.
       # (ex. You put Vanilla in /forum so change the next line to: RewriteBase /forum)
       RewriteBase /forum
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteRule ^(.*)$ index.php\?p=$1 [QSA,L]
    </IfModule>
    

    Is your Forum called forum? If yes then the htaccess is correct as far as the rewrite url is concerned.

    But you also need to add the line $Configuration['Garden']['RewriteUrls'] = TRUE; to the file config.php

    Both things work together, htaccess file and configuration in order to be able to rewrite the Urls from
    myforum.com/forum/index.php\?p=whwhhwhwn.dkzjglsjtw;o4tw to this myforum.com/

    It is very simple. If this does not work to rewrite the urls, that means the rewrite module is not enabled. It is enabled by default on centos 7 but not before so you need to enable it . Or update to CentOS 7

    https://www.centos.org/forums/viewtopic.php?t=31351

    https://devops.profitbricks.com/tutorials/install-and-configure-mod_rewrite-for-apache-on-centos-7/

  • RiverRiver MVP
    edited July 2016

    @Teo said:
    Hello guys, thanks for your tip, I'm the host of my websites is not the only one i have online all are under my VPS CentOS 6.8 (httpd + mysqld + nginx) and honestly i'm not going to modify the webserver for such things, you can understand.. I thought it was easier... :/

    @vrijvlinder said:
    Post the contents of the htaccess file please

    # Original
    # If you modify this file then change the above line to: # Modified
    <IfModule mod_rewrite.c>
       RewriteEngine On
       # Certain hosts may require the following line.
       # If vanilla is in a subfolder then you need to specify it after the /.
       # (ex. You put Vanilla in /forum so change the next line to: RewriteBase /forum)
       RewriteBase /forum
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteRule ^(.*)$ index.php\?p=$1 [QSA,L]
    </IfModule>
    

    You are using nginx as you know. NGINX is NOT APACHE and does not use .htacess or care about it.

    you do need to configure the nginx conf file properly for rewrites though.

    here is a example

    https://vanillaforums.org/discussion/30390/cant-access-categories-nginx-nice-urls

    Note:

    Determine Web server First.

    before suggesting .htaccess is at fault,

    .htaccess is FOR APACHE

    and may not even be used if the web server is not apache, and there is an increasing chance webserver will not be apache

    year old but relatively recent article
    https://www.nginx.com/blog/nginx-vs-apache-our-view/

    https://www.nginx.com/resources/wiki/start/topics/examples/likeapache-htaccess/

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

    vrijvlinder
  • Hello guys, i donno why but now everything is disappeared: http://www.proclanservers.com/forum/

    thanks.
    Teo

  • @River said:

    @Teo said:
    Hello guys, thanks for your tip, I'm the host of my websites is not the only one i have online all are under my VPS CentOS 6.8 (httpd + mysqld + nginx) and honestly i'm not going to modify the webserver for such things, you can understand.. I thought it was easier... :/

    @vrijvlinder said:
    Post the contents of the htaccess file please

    # Original
    # If you modify this file then change the above line to: # Modified
    <IfModule mod_rewrite.c>
       RewriteEngine On
       # Certain hosts may require the following line.
       # If vanilla is in a subfolder then you need to specify it after the /.
       # (ex. You put Vanilla in /forum so change the next line to: RewriteBase /forum)
       RewriteBase /forum
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteRule ^(.*)$ index.php\?p=$1 [QSA,L]
    </IfModule>
    

    You are using nginx as you know. NGINX is NOT APACHE and does not use .htacess or care about it.

    you do need to configure the nginx conf file properly for rewrites though.

    here is a example

    https://vanillaforums.org/discussion/30390/cant-access-categories-nginx-nice-urls

    Note:

    Determine Web server First.

    before suggesting .htaccess is at fault,

    .htaccess is FOR APACHE

    and may not even be used if the web server is not apache, and there is an increasing chance webserver will not be apache

    year old but relatively recent article
    https://www.nginx.com/blog/nginx-vs-apache-our-view/

    https://www.nginx.com/resources/wiki/start/topics/examples/likeapache-htaccess/

    ops sorry i didnt read your last post. I'm using Apache is httpd for centos, nginx is only for reverse proxy. my .htaccess files work properly.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    As I said before, your problem is that centos 6.8 does not have the rewrite module enabled by default. centos 7 does.

    You can either enable the rewrite module or upgrade to centos 7

  • my mod_rewrite is already enabled, i have lot of websites working on it in the .htaccess files must be something else...

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    @Teo said:
    my mod_rewrite is already enabled, i have lot of websites working on it in the .htaccess files must be something else...

    Do you have seen my comment above? https://vanillaforums.org/discussion/comment/241992/#Comment_241992

    The wrong links are already in your database. While they are stored like that http://www.proclanservers.com/forum/index.php?p=/applications/yaga/design/images/default_badges.svg#comment-1 they need to be http://www.proclanservers.com/forum/applications/yaga/design/images/default_badges.svg#comment-1

    In order to get everything correct you would either have to create a rewrite rule that would change links like

    /forum/index.php?p=/applications/yaga to /forum/applications/yaga

    or you would have to change the contents of the GDN_Activity table.

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    By the way: pretty urls do already work on your forum (proof) but you need to tell Vanilla to use them by adding $Configuration['Garden']['RewriteUrls'] = TRUE; to your /conf/config.php file

    whu606
  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited July 2016

    He said he did that already still not working for him… and his site is now not loading at all.

Sign In or Register to comment.