Example #1
0
function create_comments()
{
    if (isset($_POST['comment']) && '1' == $_POST['comment']) {
        //$profileId = $_GET['profile'];
        $profileId = $_GET['profile'];
        $workId = $_GET['work'];
        $GLOBALS['wpdb']->insert('mnbaq_profile_feedback', array('PRF_COMMENTS' => $_POST['comments'], 'PRF_ID' => $profileId, 'WRK_ID' => $workId), array('%s', '%s', '%d', '%d'));
        $feedbackId = $GLOBALS['wpdb']->insert_id;
        $emotions = list_emotions($workId);
        $selectedEmotions = array();
        foreach ($emotions as $emotion) {
            $name = 'emotion_' . $emotion->emo_id;
            if (isset($_POST[$name])) {
                $value = $_POST[$name];
                if ($value) {
                    $GLOBALS['wpdb']->insert('mnbaq_profile_feedback_emotion', array('PRF_FEEDBACK_ID' => $feedbackId, 'EMO_ID' => $emotion->emo_id), array('%d', '%d'));
                    array_push($selectedEmotions, $emotion->emo_id);
                }
            }
        }
        $profile = get_userprofile($profileId);
        wp_redirect('?action=list&work=' . $workId . '&emotions=' . join('_', $selectedEmotions) . '&exclude_category=' . $profile->cat_id . "&profile=" . $profileId);
        exit;
    }
    // end if
}
Example #2
0
echo '<img src="';
echo bloginfo('template_directory');
echo '/';
echo $work->wrk_img;
echo '"">';
?>
							
				</div>
			</div>

			<form action="" method="post"> 
				<div class="row">			
					<?php 
if (isset($_GET['work'])) {
    $workId = $_GET['work'];
    $emotions = list_emotions($workId);
    foreach ($emotions as $emotion) {
        echo '<input type="checkbox" name="emotion_';
        echo $emotion->emo_id;
        echo '" value="';
        echo $emotion->emo_id;
        echo '" id="emotion_';
        echo $emotion->emo_id;
        echo '"/>';
        echo '<label class="btn-icon" for="emotion_';
        echo $emotion->emo_id;
        echo '">';
        echo '<img class="img-icon" src="';
        echo bloginfo('template_directory');
        echo '/';
        echo $emotion->emo_img;