reverse Q&A + ACF + question post link

hey,

my message just got deleted by clicking outside of the popup...
... 2nd take: here goes,

theory approach:

admins need to be able to ask questions to specific posts
(linked by id and category or tag)

for convenience i want to edit and show these questions inside custom fields of the parent post.
initially i need to be able to add an ACF repeater field inside the post and dynamically create new ( or update etc.)
a custom post of type "question" as well as set up the necessary parent connection.

i found these links - that i think will let me do this i think
https://www.advancedcustomfields.com/resources/acfsave_post/
https://tommcfarlin.com/programmatically-create-a-post-in-wordpress/

i prefer having an additional argument for the questions containg the parent id ( rather than using a categorie or tag for every parent )

can i use existing plugin methods to create and update the questions?
can i extend these methods with arguments for the parent link without altering the core files?

- likely i can just use the wp native parent field for that ..will have to try
i noticed the post_parent is in the question WP_POST object but not displayed in the backend
how could i add this - without altering the core files.

is there a more detailed documentation
or just the plugins "usage" page and comment inside the files?
any hooks / shortcodes ?

another way could be to save the link to the question inside the the custom field after creating the question
(ACF offers dropdown style post linkage) but it would be nice to see the parent name in the backend question list view

it is "save link in question" vs "save link in parent"
i prefer: both? XD

once set up, displaying the needed questions with basic query args should be easy

tomorrow i will test my approach
hopefully it works as intended

  • Adam Czajczyk

    Hello Hannes,

    I hope you're well today and thank you for your question!

    The "Q&A" plugin doesn't include any API so there's no docs of that kind (apart from usual "usage guide). In order to "programatically" interact with it you'd need to review it's core files against available hooks/filters and/or options to enhance core features.

    However, the "questions" are custom posts of "question" type and as such you should be able to:

    - "enhance" them
    - use ACF with them

    Basically, ACF supports custom post types so it should be possible to use it to add some kind of "parent post < - > question" relationship and having such a relationship established you could then go for a custom coding to handle that in a way you need.

    I know that's very generic answer but if you need any kind of more specific tips/knowledge please let me know what exactly would you like to know and I'll ask our developers for some help if necessary.

    Best regards,
    Adam

  • Hannes

    hey,

    i managed to link my posts with a set of questions
    with the above mentioned approach.

    i will still have to do some more synchronisation but its mostly set up.

    now another dumb question:
    when viewing a single question i see no option to add an answer. (yes its activated)
    still working with unaltered q&a templates

    https://www.entrepreneurship.de/call-to-action/questions/woher-kommt-deine-energie-zum-gruenden/

    what is the "thesis-templates" folder vs "default-templates" folder ?
    is answering questions done on a completely different page?
    do i have to combine them?

    i was hoping this part would work out of the box
    am i missing something?

    thank you

    also there is a warning in my admin menu even though i removed all capabilitys for visitors:
    "[Q&A] After Visitor Submits a Question setting requires registration of the visitor, but your website is closed to registrations. You may consider to fix this using plugin settings or Wordpress settings."

    not a big thing but i think it should be removed if visitors cant post at all.

  • Hannes

    i added the answer-list and answer-edit parts from the single-question.php file
    to my templates loop for a quick n dirty test.
    ( i plan to later load the answers via ajax for the selected question)

    (click the link in the purple box)
    https://www.entrepreneurship.de/call-to-action/kursprogramm/oktober/

    so now the "add answer" button and answers show up
    although it seems i will have to manually link the css file to my page since i do not use a single dedicated page for all questions.

    i moved the general.css file to my theme folder and loaded it
    also had to copy some image files - is there a way to specify a template (not a single page) where the css file is loaded

    still wondering why answers do not show up on the
    single question page

    select one here
    https://www.entrepreneurship.de/call-to-action/questions

    unfortunately i have to build the site within a large multisite
    and there are a ton of plugins activated for the whole network that i cannot deactivate

    thanks for your help

  • Dimitris

    Hey there Hannes,

    hope you're doing good and don't mind chimning in! :slight_smile:

    As I really find myself struggling in these pages you shared in your last reply (I can't locate any action buttons in first link and the second link just gives me blank page), could you please grant us support access to your installation so that I can have a clearer state of it and better inspect it?
    You can find detailed information about granting us access (if you don't know already) here https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    This could be helpful for me to try replicate any issues as you can proceed with a plugin deactivation. Even though you can create a staging environment and safely proceed with any modifications and experiments. Have a look at Snapshot plugin for that! :wink:

    Warm regards,
    Dimitris

  • Hannes

    hey Dimitris,

    please check in again at
    https://www.entrepreneurship.de/call-to-action/kursprogramm/oktober/

    the link "Yunus Summit 2008" inside the purple box loads additional content.
    under "Fragen & Diskussion"
    you can select a question "frage1" etc

    then the answers are loaded
    so far so good.

    now i got 2 things to solve:

    1. i do not want to redirect the user after rating or posting/editing an answer
    im not a fan that the plugin does everything on a single page at the moment

    2. how can i localize the plugin - is there a german language pack
    is there a .pot file i missed
    or do i have to edit core files?

    also i think the lack of a developer level documentation is really hurts.
    i prefer to read a well written documentation than the ask support for everything i want/need to customize -.-

    please advise
    thank you

  • Hannes

    sorry to say but so far it is really frustration to work with this plugin.
    because there is basically 0 documentation.
    and you never know when the support responds

    i asked the super admin if they added:

    define('WPMUDEV_DISABLE_REMOTE_ACCESS', true);
    to the config file since i see no option to grand support access.

    i need some help because there are so many things that don to behave as i like to
    or i will see if i can get someone in a live chat or something.

  • Predrag Dubajic

    Hi Hannes,

    Thanks for the additional info about your request.

    1. i do not want to redirect the user after rating or posting/editing an answer
    im not a fan that the plugin does everything on a single page at the moment

    Unfortunately this is not something that could be changed from plugin options and it would require some code rewrite to make it work differently and I'm afraid that we currently don't have enough manpower to assist with such changes. :slight_frown:

    2. how can i localize the plugin - is there a german language pack
    is there a .pot file i missed
    or do i have to edit core files?

    There's default language file located inside /qa/languages/ folder that you can use to translate the plugin.
    We don't provide translations to other languages but we do have translation section where other users can submit translations for plugins, you can check it out here:
    https://premium.wpmudev.org/translate/projects
    Looks like the Q&A is currently at 84% for German language, you can get it from here:
    https://premium.wpmudev.org/translate/projects/qa/de/default

    also i think the lack of a developer level documentation is really hurts.
    i prefer to read a well written documentation than the ask support for everything i want/need to customize -.-

    We are aware lack of documentation for some of our plugins and it's actually something we're working on improving. :slight_smile:

    also there is no "grand support access" button in my wpmudev dashboard > support
    just the option to add a support ticket

    That's strange, can you grab a screenshot of your Support panel, it should look like this:

    Can you try logging out of WPMU DEV Dashboard plugin, clear your browser cache and then log back in to see if the button shows up after that?

    Best regards,
    Predrag

  • Adam Czajczyk

    Hello Hannes!

    Even the out of date WPMU DEV Dashboard plugin should have the "support access" feature. However, if I understand that correctly you are not a super-admin of the Multisite and you are working with just one of its sub-sites of which you are an admin. Is that correct?

    The WPMU DEV Dashboard plugin by default is available to that super-admin account that was used to enable the plugin. This can be changed by super-admin who can grant permission to use WPMU DEV Dashboard to other admins of the site but still - you would need to have your site registered with your account to let us access it and since its a multisite and is probably already registered with other account (WPMU DEV account of the super-admin/owner of the network) it may not be possible.

    Furthermore, the Multisite WordPress isn't a "set of separate sites under one umbrella" but a different kind of "regular" WP install. By that I mean that plugins "physically" are installed in a "central" location and some parts of the configuration are available only for a super-admin. It would be better to work from a "super-admin" perspective therefore. That's just a note for you to consider for future though :slight_smile:

    Getting back to the issue - this thread got a bit long and complex and I admit that even though I'm in close contact with my colleagues that responded to you recently and read entire thread twice I'm a bit lost. Could you please summarize for us the current state of the issue(s) and provide me with a brief summary of what would you expect from us then?

    I'll be more than happy to assist you and work with you on this but I just feel it would make it easier for us all if we first made sure about "where we stand" currently :slight_smile:

    Kind regards,
    Adam

  • Hannes

    hey adam,

    yes thats true here is a cleaned up list of the open issues:

    1. the /edit pages for questions and answers is not found/working. (sends me back to homepage)
    is this how the url is supposed to look like ?

    https://www.entrepreneurship.de/call-to-action/questions/edit/3971/

    displaying questions and answers works fine.

    2. still trying to stop redirecting the user after posting an answer
    im fine with digging a bit into the code - where would i start looking?

    i think thats basically whats left to do - that i dont have a plan of how to do it already.

    p.s.
    parts of the site are protected with s2member
    in case u do not have access to some pages with your support access pls do tell

    thank you so far

  • Milan

    Hello Hannes

    Hope you are well today and won't mind me chiming here. :slight_smile:

    I am not able to find site where you have granted us staff access !!! Did you revoke access intentionally ? If not, would you please please revoke it and regrant it again ?

    Furthermore, I am not able to list out any of your sites so most probably you still have not installed WPMU DEV Dashboard plugin which is requirement to let us access your site via staff access.

    Please install it on affected site, Grant us staff access via WPMU DEV > Support > Support Access > Grant Access and let me know. :slight_smile:

    Looking forward to hearing back. :slight_smile:
    Regards,
    Milan

  • Predrag Dubajic

    Hi Hannes,

    1. the /edit pages for questions and answers is not found/working. (sends me back to homepage)
    is this how the url is supposed to look like ?

    https://www.entrepreneurship.de/call-to-action/questions/edit/3971/

    displaying questions and answers works fine.

    That's the correct URL for editing questions/answers and I'm not sure why it keeps redirecting on your end as it works fine on my installation.
    Can you try disabling your other plugins and switching to default WP theme to see how it works after that, so we can check if there's any conflict on that end?

    2. still trying to stop redirecting the user after posting an answer
    im fine with digging a bit into the code - where would i start looking?

    About this one, is this for logged in users or visitors?
    What are you looking to happen after answer is posted?
    I have created wpmupredrag account on site so could you give it membership required to access questions page so I could check what currently happens.

    Best regards,
    Predrag

  • Hannes

    Hello Predrag,
    the site generally is only for logged in users

    i already noticed you. you should already have the needed privileges (s2Member Level 1)
    goto
    https://www.entrepreneurship.de/call-to-action/kursprogramm/oktober/
    select "E-learning > hannes test bitte nicht löschen ( yellow box )
    you then find the questions in the "Fragen & Diskussion" section

    as for disabling other plugins - that is not really an option since the site is part of a multisite -
    and many plugins are enabled for the whole network. - yes its fking annoying i know.
    i already tried switching to the default theme - the issue remained.

    the goal is that answering and voting should is handled with ajax > answer is saved and appended to the anwer list
    - i was hoping this plugin would use ajax for this anyway.

    also: i noticed that the plugin adds "qa-status-icon" to the title of non questions
    i checked the filter in the core.php file and it uses
    if ( in_the_loop() && is_archive( 'question' ) )
    {
    ....
    }

    is_archive( 'question' ) returns 1 on a non question archive

    from the wp codex:
    is_archive() does not accept any parameters. If you want to check if this is the archive of a custom post type, use is_post_type_archive( $post_type )

    also i think the having to alter core files to modify the look of the answers list ( the_answersList() ) is suboptimal

  • Predrag Dubajic

    Hi Hannes,

    I have performed couple more tests on my installation but still couldn't replicate the issue with redirection.
    As Dimitris already suggested previously, it would be best if there's a staging environment where things like this one can be tested without affecting your live installation.

    the goal is that answering and voting should is handled with ajax > answer is saved and appended to the anwer list
    - i was hoping this plugin would use ajax for this anyway.

    Voting and answering should all be happening on same page, can you please have a look at this page:
    http://single.dubajicp.com/questions/
    That's one of my tests sites where I setup Q&A so could you check the behaviour of the plugin there and compare it to what happens on your site, it seems to me that exactly what you're looking for but for some reason it doesn't work on your site.
    You can use subscriber as username and password in order to post questions and vote.

    also: i noticed that the plugin adds "qa-status-icon" to the title of non questions
    i checked the filter in the core.php file and it uses
    if ( in_the_loop() && is_archive( 'question' ) )

    Thanks for reporting this in, this plugin was developed before is_post_type_archive() was available within the core and it seems we missed to update this function, I'll let our devs know about this so they can change it in future updates.

    Best regards,
    Predrag

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.