Skip to:
Content
Pages
Categories
Search
Top
Bottom

perform MySQL procedure when profile is edited/saved.

  • Avatar of CommonEasy
    CommonEasy
    Participant

    @commoneasy

    Hi there,

    I want to trigger the following MySQL procedure when somebody changes his profile or presses the save button on the edit profile page. The procedure i want to perform is call dekking_ophalen. Can somebody push me in the right direction?

    Many many thanks in advance!

    edit: the stored procedure performs an update on the wp_bp_xprofile_data table from another table which uses information from the same wp_bp_xprofile_data table (so i can;t use a MySQL trigger on the wp_bp_xprofile_data table because it will create an update loop)

Viewing 1 replies (of 1 total)
  • Avatar of CommonEasy
    CommonEasy
    Participant

    @commoneasy

    Allright i tried the following code, but the all the profile pages now turn out white.

    // call stored procedure when profile is updated
    function something_updated_profile() {
      require_once 'wp-config.php';    
    	try {
                $conn = new PDO("mysql:host=$host;dbname=$dbname",
                                $username, $password);
                // execute the stored procedure
                $sql = 'CALL dekking_ophalen()';
                $q = $conn->query($sql);
                $q->setFetchMode(PDO::FETCH_ASSOC);
            } catch (PDOException $pe) {
                die("Error occurred:" . $pe->getMessage());
            }
    add_action('xprofile_updated_profile', 'something_updated_profile', 1, 3);

    I hope somebody can help me.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.