Can I display FAQs based on Product?

Discussion in 'Setting-up protection' started by 123Marketing, Dec 19, 2016.

  1. 123Marketing

    123Marketing aMember Pro Customer

    Joined:
    Jun 4, 2005
    Messages:
    128
    Two questions:

    1) Can I display FAQs based on a product or subscription?

    2) I want to change the CSS on the FAQ page - can you tell me where I can find the CSS file?
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    1,659
    Hello,

    2) You can put your custom CSS rules to site.css. It is perfect place for it.
    http://www.amember.com/docs/Site.css_file

    1) I am afraid it is not possible to do by default but aMember is flexible enough and allow to change almost anything without any changes in core files. Here is approach that allow you to do it:

    Put the following code in site.php and it will do the trick. You can update it further according your requirements:
    http://www.amember.com/docs/Site.php_file
    PHP:
    Am_Di::getInstance()->hook->add(Am_Event::BEFORE_RENDER, function(Am_Event $e) {
        
    $product_to_faq = array(
            
    => array(1,2,3)
        );
       
        if (
    strpos($e->getTemplateName(), 'helpdesk/faq.phtml')!==false) {
           
            
    $u $e->getDi()->user;
            
    $hasAccess = array();
            foreach (
    $e->getDi()->user->getActiveProductIds() as $id) {
                
    $hasAccess array_merge($hasAccess, isset($product_to_faq[$id]) ? $product_to_faq[$id] : array());
            }
           
            
    $v $e->getView();
            foreach (
    $v->faq as $k => $p) {
                if (!
    in_array($p->pk(), $hasAccess)) {
                    unset(
    $v->faq[$k]);
                }
            }
        }
    });
    I can implement plugin that will incorporate such feature to admin UI if necessary.
    Please contact us in heldpesk for a quote
    https://www.amember.com/support
  3. 123Marketing

    123Marketing aMember Pro Customer

    Joined:
    Jun 4, 2005
    Messages:
    128
    Thanks for this, Caeser.

    One last question:

    I want to only change the <p>text</p> css in the FAQ section. Is there a way to change this without altering the other css in aMember?
  4. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    1,659
    In FAQ section in admin interface you have HTML editor for each item so you can use any HTML code for your items.

    I suggest to wrap it with div with some class ie.:
    HTML:
    <div class="my-faq-item">
        <p>text</p>
        <p>text</p>
    </div>
    and then use CSS cascade:
    Code:
    .my-faq-item p {color: green;}
  5. 123Marketing

    123Marketing aMember Pro Customer

    Joined:
    Jun 4, 2005
    Messages:
    128
    Thank you for this!
    caesar likes this.

Share This Page