added the WIP company head shortcut and a menu for editing company stuff, instead of the user profile.

This commit is contained in:
2026-03-12 22:05:37 +01:00
parent b6d0959cf6
commit ccfb737949
12 changed files with 222 additions and 94 deletions

View File

@@ -0,0 +1,58 @@
<?php
/**
* Provide a admin area view for the plugin
*
* This file is used to markup the admin-facing aspects of the plugin.
*
* @link https://github.com/Duskell
* @since 1.0.0
*
* @package Partnerexpo_Core
* @subpackage Partnerexpo_Core/admin/partials
*/
if ( isset( $_POST['pexpo-core-submit'] ) ) {
if ( isset( $_POST['image_attachment_id'] ) ) {
update_user_meta(
get_current_user_id(),
'company_logo_attachment_id',
absint( $_POST['image_attachment_id'] )
);
}
if ( isset( $_POST['company_name'] ) ) {
update_user_meta(
get_current_user_id(),
'company',
sanitize_text_field( $_POST['company_name'] )
);
}
}
$logo_id = get_user_meta( get_current_user_id(), 'company_logo_attachment_id', true );
$logo_url = $logo_id ? wp_get_attachment_url( $logo_id ) : '';
wp_enqueue_media();
?>
<div class="pexpo-core-business-wrap">
<h1><?php echo esc_html__('Céges adataid', 'partnerexpo-core'); ?></h1>
<p><?php echo esc_html__('Itt láthatod a regisztrációnál beállított céges adataidat, és szerkesztheted azokat.', 'partnerexpo-core'); ?></p>
<form method='post'>
<div class="pexpo-core-business-logo-wrapper">
<h2><?php echo esc_html__('Céges logó', 'partnerexpo-core'); ?></h2>
<div class='pexpo-core-business-logo-preview-wrapper'>
<img id='pexpo-core-business-logo-preview' src='<?php echo esc_url( $logo_url ); ?>' height='100'>
</div>
<input id="pexpo-core-upload-image-button" type="button" class="button" value="<?php _e( 'Kép feltöltése', 'partnerexpo-core' ); ?>" />
<input type='hidden' name='image_attachment_id' id='pexpo-core-business-logo-attachment-id' value='<?php echo esc_attr( $logo_id ); ?>'>
</div>
<div class="pexpo-core-business-data-wrapper">
<h2><?php echo esc_html__('Cég neve', 'partnerexpo-core'); ?></h2>
<input type="text" name="company_name" value="<?php echo esc_attr( get_user_meta( get_current_user_id(), 'company', true ) ); ?>" class="regular-text" />
</div>
<input type="submit" name="pexpo-core-submit" value="<?php _e( 'Mentés', 'partnerexpo-core' ); ?>" class="button-primary">
</form>
</div>