• Resolved szwp

    (@szwordpress)


    I made the ID fields in the dbview table Clickable Links. When clicked, the ID ($value) is passed to another dbview view.

    I am using the plugin PHP Snippets. The PHP Snippets encapsulates the code as a shortcode that one can place on a page. I would like to capture the ID that was clicked in the dbview so I can pass it to PHP Snippets. I placed the following the in dbview for the ID hoping to trigger the PHP Snippets shortcode with no luck.

    do_shortcode(“[printAttendeedetailList name=$value]”); The printAttendeedetailList is the PHP Snippets shortcode.

    Is there a way to call a shortcode in the dbview PHP area? What would you recommend?

    Thanks for your time.

    https://www.ads-software.com/plugins/dbview/

Viewing 1 replies (of 1 total)
  • Thread Starter szwp

    (@szwordpress)

    Problem that I was trying to solve:

    A dbview that has has the following 3 Columns:

    Export Users, Event ID, Event Name

    Note, Export Users is not a field in the database, but “Event ID” and “Event Name” are.

    Make the column in dbview “Export Users” a “clickable link”, when clicked, the value of “Event ID” column is passed to a backend PHP code

    Solution
    ———-
    I created a dbview with the the following select statement:
    select event_city As “Export Users”, id As “Event ID”, event_name As Event, …

    In the select statement, I selected the field event_city as my dummy field in the dbview and called its column “Export Users”. This column will be clickable as shown below in the code.

    Place this PHP in dbview under the column “Export Users”

    "<a href='$value'>$name</a>"; <== make the field in the table a hyperlink
    $myevent=$row['Event ID'];
    return "<a href= '/mydirectory/myphpfile.php?event_id=$myevent'>Export Users</a>";
    In your PHP file get the value using $_GET 
    
    e.g. function myphpfile.php() {
    	$event_id= $_GET['event_id']; <== use $_GET to get the value passed from dbview
    ....
    ...
    }

    That’s it. By the way I did not use shortcode I called the PHP directdly.

Viewing 1 replies (of 1 total)
  • The topic ‘dbview passing values/triggering shortcodes’ is closed to new replies.